Chromium Code Reviews| 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 #include <vector> | |
| 10 | |
| 11 #include "chrome/browser/custom_handlers/protocol_handler.h" | |
| 12 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | |
| 13 #include "chrome/browser/ui/webui/options/options_ui.h" | |
| 14 #include "content/common/notification_registrar.h" | |
| 15 | |
| 16 class DictionaryValue; | |
| 17 | |
| 18 class HandlerOptionsHandler : public OptionsPageUIHandler { | |
| 19 public: | |
| 20 explicit HandlerOptionsHandler(); | |
| 21 virtual ~HandlerOptionsHandler(); | |
| 22 | |
| 23 // OptionsPageUIHandler implementation. | |
| 24 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | |
| 25 virtual void Initialize(); | |
| 26 virtual void RegisterMessages(); | |
| 27 | |
| 28 // NotificationObserver implementation. | |
| 29 virtual void Observe(NotificationType type, | |
| 30 const NotificationSource& source, | |
| 31 const NotificationDetails& details); | |
| 32 | |
| 33 private: | |
| 34 // Called when the user toggles whether custom handlers are enabled. | |
| 35 void SetHandlersEnabled(const ListValue* args); | |
| 36 | |
| 37 // Called when the user sets a new default handler for a protocol. | |
| 38 void SetDefault(const ListValue* args); | |
| 39 | |
| 40 // Parses a ProtocolHandler out of the arguments passed back from the view. | |
| 41 // @param args a list of [protocol, url, title]. | |
|
Evan Stade
2011/05/19 17:08:42
@param is only used for javascript. C++ style owul
koz (OOO until 15th September)
2011/05/19 21:07:52
Done.
| |
| 42 ProtocolHandler ParseHandlerFromArgs(const ListValue* args) const; | |
| 43 | |
| 44 // Returns a JSON object describing the set of protocol handlers for the | |
| 45 // given protocol. | |
| 46 DictionaryValue* GetHandlersForProtocol(const std::string& protocol); | |
| 47 | |
| 48 // Called when the JS PasswordManager object is initialized. | |
| 49 void UpdateHandlerList(); | |
| 50 | |
| 51 // Remove a handler. | |
| 52 // @param args the index of the handler to be removed. | |
| 53 void RemoveHandler(const ListValue* args); | |
|
Evan Stade
2011/05/19 17:08:42
I'm wary of using the index as the identifier beca
koz (OOO until 15th September)
2011/05/19 21:07:52
Ah sorry, the comment was out of date here.
Fixed.
| |
| 54 | |
| 55 ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); | |
|
Evan Stade
2011/05/19 17:08:42
newline
koz (OOO until 15th September)
2011/05/19 21:07:52
Done.
| |
| 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 |