[Extensions] Factor RouteFunction() calls into a separate method

ObjectBackedNativeHandlers have a RouteFunction() ability, which
essentially exposes a callback to JS. Routing all these functions can
be potentially expensive (at the scale we do it).

Factor RouteFunction() calls into an
ObjectBackedNativeHandler::Initialize() method (also exposed as
NativeHandler::Initialize()), and ensure (through a DCHECK) that
this is the only place that allows RouteFunction() calls (as well
as potential future initialization). This will allow us to
experiment with where to put this logic.

For now, call near construction of each handler, which ensures that this
patch does *not* introduce a behavior change.  Future patches will
modify this flow.

This patch should have no functional effect.

Bug: 805244

Change-Id: I3cd886a85e2c8e4ebb17b01d640e030df9b40700
Reviewed-on: https://chromium-review.googlesource.com/879721
Reviewed-by: Istiaque Ahmed <[email protected]>
Commit-Queue: Devlin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#532168}
diff --git a/extensions/renderer/utils_native_handler.h b/extensions/renderer/utils_native_handler.h
index 6a2ae4da..05adfe02 100644
--- a/extensions/renderer/utils_native_handler.h
+++ b/extensions/renderer/utils_native_handler.h
@@ -16,6 +16,9 @@
   explicit UtilsNativeHandler(ScriptContext* context);
   ~UtilsNativeHandler() override;
 
+  // ObjectBackedNativeHandler:
+  void AddRoutes() override;
+
  private:
   // |args| consists of one argument: an arbitrary value. Returns a deep copy of
   // that value. The copy will have no references to nested values of the