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