Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / options_ui.h
index 8117ed6..b14a89d 100644 (file)
@@ -8,11 +8,10 @@
 #include <string>
 #include <vector>
 
+#include "base/callback_list.h"
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
-#include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_types.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_ui_controller.h"
 #include "content/public/browser/web_ui_message_handler.h"
@@ -37,14 +36,13 @@ class PointerDeviceObserver;
 namespace options {
 
 // The base class handler of Javascript messages of options pages.
-class OptionsPageUIHandler : public content::WebUIMessageHandler,
-                             public content::NotificationObserver {
+class OptionsPageUIHandler : public content::WebUIMessageHandler {
  public:
   // Key for identifying the Settings App localized_strings in loadTimeData.
   static const char kSettingsAppKey[];
 
   OptionsPageUIHandler();
-  virtual ~OptionsPageUIHandler();
+  ~OptionsPageUIHandler() override;
 
   // Is this handler enabled?
   virtual bool IsEnabled();
@@ -68,12 +66,7 @@ class OptionsPageUIHandler : public content::WebUIMessageHandler,
   virtual void Uninitialize() {}
 
   // WebUIMessageHandler implementation.
-  virtual void RegisterMessages() OVERRIDE {}
-
-  // content::NotificationObserver implementation.
-  virtual void Observe(int type,
-                       const content::NotificationSource& source,
-                       const content::NotificationDetails& details) OVERRIDE {}
+  void RegisterMessages() override {}
 
  protected:
   struct OptionsStringResource {
@@ -108,6 +101,7 @@ class OptionsPageUIHandler : public content::WebUIMessageHandler,
 class OptionsPageUIHandlerHost {
  public:
   virtual void InitializeHandlers() = 0;
+  virtual void OnFinishedLoading() {}
 
  protected:
   virtual ~OptionsPageUIHandlerHost() {}
@@ -118,8 +112,15 @@ class OptionsUI : public content::WebUIController,
                   public content::WebContentsObserver,
                   public OptionsPageUIHandlerHost {
  public:
+  typedef base::CallbackList<void()> OnFinishedLoadingCallbackList;
+
   explicit OptionsUI(content::WebUI* web_ui);
-  virtual ~OptionsUI();
+  ~OptionsUI() override;
+
+  // Registers a callback to be called once the settings frame has finished
+  // loading on the HTML/JS side.
+  scoped_ptr<OnFinishedLoadingCallbackList::Subscription>
+      RegisterOnFinishedLoadingCallback(const base::Closure& callback);
 
   // Takes the suggestions from |result| and adds them to |suggestions| so that
   // they can be passed to a JavaScript function.
@@ -131,17 +132,15 @@ class OptionsUI : public content::WebUIController,
       ui::ScaleFactor scale_factor);
 
   // Overridden from content::WebContentsObserver:
-  virtual void DidStartProvisionalLoadForFrame(
-      int64 frame_id,
-      int64 parent_frame_id,
-      bool is_main_frame,
+  void DidStartProvisionalLoadForFrame(
+      content::RenderFrameHost* render_frame_host,
       const GURL& validated_url,
       bool is_error_page,
-      bool is_iframe_srcdoc,
-      content::RenderViewHost* render_view_host) OVERRIDE;
+      bool is_iframe_srcdoc) override;
 
   // Overridden from OptionsPageUIHandlerHost:
-  virtual void InitializeHandlers() OVERRIDE;
+  void InitializeHandlers() override;
+  void OnFinishedLoading() override;
 
  private:
   // Adds OptionsPageUiHandler to the handlers list if handler is enabled.
@@ -151,6 +150,7 @@ class OptionsUI : public content::WebUIController,
   bool initialized_handlers_;
 
   std::vector<OptionsPageUIHandler*> handlers_;
+  OnFinishedLoadingCallbackList on_finished_loading_callbacks_;
 
 #if defined(OS_CHROMEOS)
   scoped_ptr<chromeos::system::PointerDeviceObserver>