| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 14 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 14 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 15 #include "content/common/content_notification_types.h" |
| 15 #include "content/common/notification_observer.h" | 16 #include "content/common/notification_observer.h" |
| 16 #include "content/common/notification_registrar.h" | 17 #include "content/common/notification_registrar.h" |
| 17 #include "content/common/notification_type.h" | |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 class PrefService; | 20 class PrefService; |
| 21 struct UserMetricsAction; | 21 struct UserMetricsAction; |
| 22 | 22 |
| 23 // The base class handler of Javascript messages of options pages. | 23 // The base class handler of Javascript messages of options pages. |
| 24 class OptionsPageUIHandler : public WebUIMessageHandler, | 24 class OptionsPageUIHandler : public WebUIMessageHandler, |
| 25 public NotificationObserver { | 25 public NotificationObserver { |
| 26 public: | 26 public: |
| 27 OptionsPageUIHandler(); | 27 OptionsPageUIHandler(); |
| 28 virtual ~OptionsPageUIHandler(); | 28 virtual ~OptionsPageUIHandler(); |
| 29 | 29 |
| 30 // Is this handler enabled? | 30 // Is this handler enabled? |
| 31 virtual bool IsEnabled(); | 31 virtual bool IsEnabled(); |
| 32 | 32 |
| 33 // Collects localized strings for options page. | 33 // Collects localized strings for options page. |
| 34 virtual void GetLocalizedValues(DictionaryValue* localized_strings) = 0; | 34 virtual void GetLocalizedValues(DictionaryValue* localized_strings) = 0; |
| 35 | 35 |
| 36 // Initialize the page. Called once the DOM is available for manipulation. | 36 // Initialize the page. Called once the DOM is available for manipulation. |
| 37 // This will be called only once. | 37 // This will be called only once. |
| 38 virtual void Initialize() {} | 38 virtual void Initialize() {} |
| 39 | 39 |
| 40 // Uninitializes the page. Called just before the object is destructed. | 40 // Uninitializes the page. Called just before the object is destructed. |
| 41 virtual void Uninitialize() {} | 41 virtual void Uninitialize() {} |
| 42 | 42 |
| 43 // WebUIMessageHandler implementation. | 43 // WebUIMessageHandler implementation. |
| 44 virtual void RegisterMessages() {} | 44 virtual void RegisterMessages() {} |
| 45 | 45 |
| 46 // NotificationObserver implementation. | 46 // NotificationObserver implementation. |
| 47 virtual void Observe(NotificationType type, | 47 virtual void Observe(int type, |
| 48 const NotificationSource& source, | 48 const NotificationSource& source, |
| 49 const NotificationDetails& details) {} | 49 const NotificationDetails& details) {} |
| 50 | 50 |
| 51 void UserMetricsRecordAction(const UserMetricsAction& action); | 51 void UserMetricsRecordAction(const UserMetricsAction& action); |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 struct OptionsStringResource { | 54 struct OptionsStringResource { |
| 55 // The name of the resource in templateData. | 55 // The name of the resource in templateData. |
| 56 const char* name; | 56 const char* name; |
| 57 // The .grd ID for the resource (IDS_*). | 57 // The .grd ID for the resource (IDS_*). |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Adds OptionsPageUiHandler to the handlers list if handler is enabled. | 100 // Adds OptionsPageUiHandler to the handlers list if handler is enabled. |
| 101 void AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 101 void AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 102 OptionsPageUIHandler* handler); | 102 OptionsPageUIHandler* handler); |
| 103 | 103 |
| 104 bool initialized_handlers_; | 104 bool initialized_handlers_; |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(OptionsUI); | 106 DISALLOW_COPY_AND_ASSIGN(OptionsUI); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ | 109 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ |
| OLD | NEW |