| 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_HANDLER_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/custom_handlers/protocol_handler.h" | 10 #include "chrome/browser/custom_handlers/protocol_handler.h" |
| 11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 12 #include "chrome/browser/ui/webui/options/options_ui.h" | 12 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 13 #include "content/common/notification_registrar.h" | 13 #include "content/common/notification_registrar.h" |
| 14 | 14 |
| 15 namespace base { |
| 15 class DictionaryValue; | 16 class DictionaryValue; |
| 17 } |
| 16 | 18 |
| 17 class HandlerOptionsHandler : public OptionsPageUIHandler { | 19 class HandlerOptionsHandler : public OptionsPageUIHandler { |
| 18 public: | 20 public: |
| 19 HandlerOptionsHandler(); | 21 HandlerOptionsHandler(); |
| 20 virtual ~HandlerOptionsHandler(); | 22 virtual ~HandlerOptionsHandler(); |
| 21 | 23 |
| 22 // OptionsPageUIHandler implementation. | 24 // OptionsPageUIHandler implementation. |
| 23 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 25 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 24 virtual void Initialize(); | 26 virtual void Initialize(); |
| 25 virtual void RegisterMessages(); | 27 virtual void RegisterMessages(); |
| 26 | 28 |
| 27 // NotificationObserver implementation. | 29 // NotificationObserver implementation. |
| 28 virtual void Observe(int type, | 30 virtual void Observe(int type, |
| 29 const NotificationSource& source, | 31 const NotificationSource& source, |
| 30 const NotificationDetails& details); | 32 const NotificationDetails& details); |
| 31 | 33 |
| 32 private: | 34 private: |
| 33 // Called when the user toggles whether custom handlers are enabled. | 35 // Called when the user toggles whether custom handlers are enabled. |
| 34 void SetHandlersEnabled(const ListValue* args); | 36 void SetHandlersEnabled(const ListValue* args); |
| 35 | 37 |
| 36 // Called when the user sets a new default handler for a protocol. | 38 // Called when the user sets a new default handler for a protocol. |
| 37 void SetDefault(const ListValue* args); | 39 void SetDefault(const ListValue* args); |
| 38 | 40 |
| 39 // Called when the user clears the default handler for a protocol. | 41 // Called when the user clears the default handler for a protocol. |
| 40 // |args| is the string name of the protocol to clear. | 42 // |args| is the string name of the protocol to clear. |
| 41 void ClearDefault(const ListValue* args); | 43 void ClearDefault(const ListValue* args); |
| 42 | 44 |
| 43 // Parses a ProtocolHandler out of the arguments passed back from the view. | 45 // Parses a ProtocolHandler out of the arguments passed back from the view. |
| 44 // |args| is a list of [protocol, url, title]. | 46 // |args| is a list of [protocol, url, title]. |
| 45 ProtocolHandler ParseHandlerFromArgs(const ListValue* args) const; | 47 ProtocolHandler ParseHandlerFromArgs(const ListValue* args) const; |
| 46 | 48 |
| 47 // Returns a JSON object describing the set of protocol handlers for the | 49 // Returns a JSON object describing the set of protocol handlers for the |
| 48 // given protocol. | 50 // given protocol. |
| 49 DictionaryValue* GetHandlersForProtocol(const std::string& protocol); | 51 base::DictionaryValue* GetHandlersForProtocol(const std::string& protocol); |
| 50 | 52 |
| 51 // Called when the JS PasswordManager object is initialized. | 53 // Called when the JS PasswordManager object is initialized. |
| 52 void UpdateHandlerList(); | 54 void UpdateHandlerList(); |
| 53 | 55 |
| 54 // Remove a handler. | 56 // Remove a handler. |
| 55 // |args| is a list of [protocol, url, title]. | 57 // |args| is a list of [protocol, url, title]. |
| 56 void RemoveHandler(const ListValue* args); | 58 void RemoveHandler(const ListValue* args); |
| 57 | 59 |
| 58 ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); | 60 ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); |
| 59 | 61 |
| 60 NotificationRegistrar notification_registrar_; | 62 NotificationRegistrar notification_registrar_; |
| 61 | 63 |
| 62 DISALLOW_COPY_AND_ASSIGN(HandlerOptionsHandler); | 64 DISALLOW_COPY_AND_ASSIGN(HandlerOptionsHandler); |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ | 67 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ |
| OLD | NEW |