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