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

Side by Side Diff: chrome/browser/ui/webui/options2/handler_options_handler2.cc

Issue 10381064: Remove the gyp flag for registerProtocolHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h" 5 #include "chrome/browser/ui/webui/options2/handler_options_handler2.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 105
106 void HandlerOptionsHandler::GetIgnoredHandlers(ListValue* handlers) { 106 void HandlerOptionsHandler::GetIgnoredHandlers(ListValue* handlers) {
107 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); 107 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry();
108 ProtocolHandlerRegistry::ProtocolHandlerList ignored_handlers = 108 ProtocolHandlerRegistry::ProtocolHandlerList ignored_handlers =
109 registry->GetIgnoredHandlers(); 109 registry->GetIgnoredHandlers();
110 return GetHandlersAsListValue(ignored_handlers, handlers); 110 return GetHandlersAsListValue(ignored_handlers, handlers);
111 } 111 }
112 112
113 void HandlerOptionsHandler::UpdateHandlerList() { 113 void HandlerOptionsHandler::UpdateHandlerList() {
114 #if defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
115 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); 114 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry();
116 std::vector<std::string> protocols; 115 std::vector<std::string> protocols;
117 registry->GetRegisteredProtocols(&protocols); 116 registry->GetRegisteredProtocols(&protocols);
118 117
119 ListValue handlers; 118 ListValue handlers;
120 for (std::vector<std::string>::iterator protocol = protocols.begin(); 119 for (std::vector<std::string>::iterator protocol = protocols.begin();
121 protocol != protocols.end(); protocol++) { 120 protocol != protocols.end(); protocol++) {
122 DictionaryValue* handler_value = new DictionaryValue(); 121 DictionaryValue* handler_value = new DictionaryValue();
123 GetHandlersForProtocol(*protocol, handler_value); 122 GetHandlersForProtocol(*protocol, handler_value);
124 handlers.Append(handler_value); 123 handlers.Append(handler_value);
125 } 124 }
126 125
127 scoped_ptr<ListValue> ignored_handlers(new ListValue()); 126 scoped_ptr<ListValue> ignored_handlers(new ListValue());
128 GetIgnoredHandlers(ignored_handlers.get()); 127 GetIgnoredHandlers(ignored_handlers.get());
129 web_ui()->CallJavascriptFunction("HandlerOptions.setHandlers", handlers); 128 web_ui()->CallJavascriptFunction("HandlerOptions.setHandlers", handlers);
130 web_ui()->CallJavascriptFunction("HandlerOptions.setIgnoredHandlers", 129 web_ui()->CallJavascriptFunction("HandlerOptions.setIgnoredHandlers",
131 *ignored_handlers); 130 *ignored_handlers);
132 #endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
133 } 131 }
134 132
135 void HandlerOptionsHandler::RemoveHandler(const ListValue* args) { 133 void HandlerOptionsHandler::RemoveHandler(const ListValue* args) {
136 ListValue* list; 134 ListValue* list;
137 if (!args->GetList(0, &list)) { 135 if (!args->GetList(0, &list)) {
138 NOTREACHED(); 136 NOTREACHED();
139 return; 137 return;
140 } 138 }
141 139
142 ProtocolHandler handler(ParseHandlerFromArgs(list)); 140 ProtocolHandler handler(ParseHandlerFromArgs(list));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 int type, 201 int type,
204 const content::NotificationSource& source, 202 const content::NotificationSource& source,
205 const content::NotificationDetails& details) { 203 const content::NotificationDetails& details) {
206 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) 204 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED)
207 UpdateHandlerList(); 205 UpdateHandlerList();
208 else 206 else
209 NOTREACHED(); 207 NOTREACHED();
210 } 208 }
211 209
212 } // namespace options2 210 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698