Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / handler_options_handler.h
blob7c6f12e791cefb6e9b6ceb8bbbffed6baa409bed
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_
8 #include <string>
10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
11 #include "chrome/browser/ui/webui/options/options_ui.h"
12 #include "chrome/common/custom_handlers/protocol_handler.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
16 ////////////////////////////////////////////////////////////////////////////////
17 // HandlerOptionsHandler
19 // Listen for changes to protocol handlers (i.e. registerProtocolHandler()).
20 // This get triggered whenever a user allows a specific website or application
21 // to handle clicks on a link with a specified protocol (i.e. mailto: -> Gmail).
23 namespace base {
24 class DictionaryValue;
27 namespace options {
29 class HandlerOptionsHandler : public OptionsPageUIHandler,
30 public content::NotificationObserver {
31 public:
32 HandlerOptionsHandler();
33 virtual ~HandlerOptionsHandler();
35 // OptionsPageUIHandler implementation.
36 virtual void GetLocalizedValues(
37 base::DictionaryValue* localized_strings) OVERRIDE;
38 virtual void InitializeHandler() OVERRIDE;
39 virtual void InitializePage() OVERRIDE;
40 virtual void RegisterMessages() OVERRIDE;
42 // content::NotificationObserver implementation.
43 virtual void Observe(int type,
44 const content::NotificationSource& source,
45 const content::NotificationDetails& details) OVERRIDE;
47 private:
48 // Called when the user toggles whether custom handlers are enabled.
49 void SetHandlersEnabled(const base::ListValue* args);
51 // Called when the user sets a new default handler for a protocol.
52 void SetDefault(const base::ListValue* args);
54 // Called when the user clears the default handler for a protocol.
55 // |args| is the string name of the protocol to clear.
56 void ClearDefault(const base::ListValue* args);
58 // Parses a ProtocolHandler out of the arguments passed back from the view.
59 // |args| is a list of [protocol, url, title].
60 ProtocolHandler ParseHandlerFromArgs(const base::ListValue* args) const;
62 // Returns a JSON object describing the set of protocol handlers for the
63 // given protocol.
64 void GetHandlersForProtocol(const std::string& protocol,
65 base::DictionaryValue* value);
67 // Returns a JSON list of the ignored protocol handlers.
68 void GetIgnoredHandlers(base::ListValue* handlers);
70 // Called when the JS PasswordManager object is initialized.
71 void UpdateHandlerList();
73 // Remove a handler.
74 // |args| is a list of [protocol, url, title].
75 void RemoveHandler(const base::ListValue* args);
77 // Remove an ignored handler.
78 // |args| is a list of [protocol, url, title].
79 void RemoveIgnoredHandler(const base::ListValue* args);
81 ProtocolHandlerRegistry* GetProtocolHandlerRegistry();
83 content::NotificationRegistrar notification_registrar_;
85 DISALLOW_COPY_AND_ASSIGN(HandlerOptionsHandler);
88 } // namespace options
90 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_