Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / handler_options_handler.h
blobaa331280bdfff4801c9ef08a349110d16f1c8532
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 ~HandlerOptionsHandler() override;
35 // OptionsPageUIHandler implementation.
36 void GetLocalizedValues(base::DictionaryValue* localized_strings) override;
37 void InitializeHandler() override;
38 void InitializePage() override;
39 void RegisterMessages() override;
41 // content::NotificationObserver implementation.
42 void Observe(int type,
43 const content::NotificationSource& source,
44 const content::NotificationDetails& details) override;
46 private:
47 // Called when the user toggles whether custom handlers are enabled.
48 void SetHandlersEnabled(const base::ListValue* args);
50 // Called when the user sets a new default handler for a protocol.
51 void SetDefault(const base::ListValue* args);
53 // Called when the user clears the default handler for a protocol.
54 // |args| is the string name of the protocol to clear.
55 void ClearDefault(const base::ListValue* args);
57 // Parses a ProtocolHandler out of the arguments passed back from the view.
58 // |args| is a list of [protocol, url, title].
59 ProtocolHandler ParseHandlerFromArgs(const base::ListValue* args) const;
61 // Returns a JSON object describing the set of protocol handlers for the
62 // given protocol.
63 void GetHandlersForProtocol(const std::string& protocol,
64 base::DictionaryValue* value);
66 // Returns a JSON list of the ignored protocol handlers.
67 void GetIgnoredHandlers(base::ListValue* handlers);
69 // Called when the JS PasswordManager object is initialized.
70 void UpdateHandlerList();
72 // Remove a handler.
73 // |args| is a list of [protocol, url, title].
74 void RemoveHandler(const base::ListValue* args);
76 // Remove an ignored handler.
77 // |args| is a list of [protocol, url, title].
78 void RemoveIgnoredHandler(const base::ListValue* args);
80 ProtocolHandlerRegistry* GetProtocolHandlerRegistry();
82 content::NotificationRegistrar notification_registrar_;
84 DISALLOW_COPY_AND_ASSIGN(HandlerOptionsHandler);
87 } // namespace options
89 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_