Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/ui/webui/settings/protocol_handlers_handler.h

Issue 2131953002: Site Settings Desktop: Implement protocol handler section. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_PROTOCOL_HANDLERS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_PROTOCOL_HANDLERS_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
12 #include "chrome/browser/ui/webui/options/options_ui.h" 12 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
13 #include "chrome/common/custom_handlers/protocol_handler.h" 13 #include "chrome/common/custom_handlers/protocol_handler.h"
14 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 16
17 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
18 // HandlerOptionsHandler 18 // ProtocolHandlersHandler
19 19
20 // Listen for changes to protocol handlers (i.e. registerProtocolHandler()). 20 // Listen for changes to protocol handlers (i.e. registerProtocolHandler()).
21 // This get triggered whenever a user allows a specific website or application 21 // This get triggered whenever a user allows a specific website or application
22 // to handle clicks on a link with a specified protocol (i.e. mailto: -> Gmail). 22 // to handle clicks on a link with a specified protocol (i.e. mailto: -> Gmail).
23 23
24 namespace base { 24 namespace base {
25 class DictionaryValue; 25 class DictionaryValue;
26 } 26 }
27 27
28 namespace options { 28 namespace settings {
29 29
30 class HandlerOptionsHandler : public OptionsPageUIHandler, 30 class ProtocolHandlersHandler : public SettingsPageUIHandler,
31 public content::NotificationObserver { 31 public content::NotificationObserver {
32 public: 32 public:
33 HandlerOptionsHandler(); 33 ProtocolHandlersHandler();
34 ~HandlerOptionsHandler() override; 34 ~ProtocolHandlersHandler() override;
35 35
36 // OptionsPageUIHandler implementation. 36 // SettingsPageUIHandler:
37 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; 37 void OnJavascriptAllowed() override;
38 void InitializeHandler() override; 38 void OnJavascriptDisallowed() override;
39 void InitializePage() override;
40 void RegisterMessages() override; 39 void RegisterMessages() override;
41 40
42 // content::NotificationObserver implementation. 41 // content::NotificationObserver:
43 void Observe(int type, 42 void Observe(int type,
44 const content::NotificationSource& source, 43 const content::NotificationSource& source,
45 const content::NotificationDetails& details) override; 44 const content::NotificationDetails& details) override;
46 45
47 private: 46 private:
47 // Called to fetch the initial list of data to show.
48 void InitializeProtocolHandlerList(const base::ListValue* args);
49
50 // Notifies the JS side whether the handlers are enabled or not.
51 void SendHandlersEnabledValue();
52
48 // Called when the user toggles whether custom handlers are enabled. 53 // Called when the user toggles whether custom handlers are enabled.
49 void SetHandlersEnabled(const base::ListValue* args); 54 void SetHandlersEnabled(const base::ListValue* args);
50 55
51 // Called when the user sets a new default handler for a protocol. 56 // Called when the user sets a new default handler for a protocol.
52 void SetDefault(const base::ListValue* args); 57 void SetDefault(const base::ListValue* args);
53 58
54 // Called when the user clears the default handler for a protocol. 59 // Called when the user clears the default handler for a protocol.
55 // |args| is the string name of the protocol to clear. 60 // |args| is the string name of the protocol to clear.
56 void ClearDefault(const base::ListValue* args); 61 void ClearDefault(const base::ListValue* args);
57 62
(...skipping 17 matching lines...) Expand all
75 void RemoveHandler(const base::ListValue* args); 80 void RemoveHandler(const base::ListValue* args);
76 81
77 // Remove an ignored handler. 82 // Remove an ignored handler.
78 // |args| is a list of [protocol, url, title]. 83 // |args| is a list of [protocol, url, title].
79 void RemoveIgnoredHandler(const base::ListValue* args); 84 void RemoveIgnoredHandler(const base::ListValue* args);
80 85
81 ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); 86 ProtocolHandlerRegistry* GetProtocolHandlerRegistry();
82 87
83 content::NotificationRegistrar notification_registrar_; 88 content::NotificationRegistrar notification_registrar_;
84 89
85 DISALLOW_COPY_AND_ASSIGN(HandlerOptionsHandler); 90 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlersHandler);
86 }; 91 };
87 92
88 } // namespace options 93 } // namespace settings
89 94
90 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_HANDLER_OPTIONS_HANDLER_H_ 95 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PROTOCOL_HANDLERS_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_ui.cc ('k') | chrome/browser/ui/webui/settings/protocol_handlers_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698