Chromium Code Reviews| Index: chrome/browser/ui/webui/options/handler_options_handler.h |
| diff --git a/chrome/browser/ui/webui/options/handler_options_handler.h b/chrome/browser/ui/webui/options/handler_options_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8ac223f5fdbe5f1ec7598e3793ef8cca9aea0d85 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/options/handler_options_handler.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "chrome/browser/custom_handlers/protocol_handler.h" |
| +#include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| +#include "chrome/browser/ui/webui/options/options_ui.h" |
| +#include "content/common/notification_registrar.h" |
| + |
| +class DictionaryValue; |
| + |
| +class HandlerOptionsHandler : public OptionsPageUIHandler { |
| + public: |
| + explicit HandlerOptionsHandler(); |
| + virtual ~HandlerOptionsHandler(); |
| + |
| + // OptionsPageUIHandler implementation. |
| + virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
| + virtual void Initialize(); |
| + virtual void RegisterMessages(); |
| + |
| + // NotificationObserver implementation. |
| + virtual void Observe(NotificationType type, |
| + const NotificationSource& source, |
| + const NotificationDetails& details); |
| + |
| + private: |
| + // Called when the user toggles whether custom handlers are enabled. |
| + void SetHandlersEnabled(const ListValue* args); |
| + |
| + // Called when the user sets a new default handler for a protocol. |
| + void SetDefault(const ListValue* args); |
| + |
| + // Parses a ProtocolHandler out of the arguments passed back from the view. |
| + // @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.
|
| + ProtocolHandler ParseHandlerFromArgs(const ListValue* args) const; |
| + |
| + // Returns a JSON object describing the set of protocol handlers for the |
| + // given protocol. |
| + DictionaryValue* GetHandlersForProtocol(const std::string& protocol); |
| + |
| + // Called when the JS PasswordManager object is initialized. |
| + void UpdateHandlerList(); |
| + |
| + // Remove a handler. |
| + // @param args the index of the handler to be removed. |
| + 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.
|
| + |
| + ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); |
|
Evan Stade
2011/05/19 17:08:42
newline
koz (OOO until 15th September)
2011/05/19 21:07:52
Done.
|
| + NotificationRegistrar notification_registrar_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HandlerOptionsHandler); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ |