#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"
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();
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 {
class OptionsPageUIHandlerHost {
public:
virtual void InitializeHandlers() = 0;
+ virtual void OnFinishedLoading() {}
protected:
virtual ~OptionsPageUIHandlerHost() {}
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.
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.
bool initialized_handlers_;
std::vector<OptionsPageUIHandler*> handlers_;
+ OnFinishedLoadingCallbackList on_finished_loading_callbacks_;
#if defined(OS_CHROMEOS)
scoped_ptr<chromeos::system::PointerDeviceObserver>