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

Side by Side Diff: chrome/browser/custom_handlers/protocol_handler_registry.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/custom_handlers/protocol_handler_registry.h" 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "chrome/browser/custom_handlers/protocol_handler.h" 9 #include "chrome/browser/custom_handlers/protocol_handler.h"
10 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" 10 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 ProtocolHandler* handler) { 253 ProtocolHandler* handler) {
254 } 254 }
255 255
256 void ProtocolHandlerRegistry::OnIgnoreRegisterProtocolHandler( 256 void ProtocolHandlerRegistry::OnIgnoreRegisterProtocolHandler(
257 ProtocolHandler* handler) { 257 ProtocolHandler* handler) {
258 IgnoreProtocolHandler(handler); 258 IgnoreProtocolHandler(handler);
259 Save(); 259 Save();
260 } 260 }
261 261
262 void ProtocolHandlerRegistry::RegisterPrefs(PrefService* prefService) { 262 void ProtocolHandlerRegistry::RegisterPrefs(PrefService* prefService) {
263 prefService->RegisterListPref(prefs::kRegisteredProtocolHandlers); 263 prefService->RegisterListPref(prefs::kRegisteredProtocolHandlers,
264 prefService->RegisterListPref(prefs::kIgnoredProtocolHandlers); 264 false /* don't sync pref */);
265 prefService->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true); 265 prefService->RegisterListPref(prefs::kIgnoredProtocolHandlers,
266 false /* don't sync pref */);
267 prefService->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true,
268 false /* don't sync pref */);
266 } 269 }
267 270
268 // Delegate -------------------------------------------------------------------- 271 // Delegate --------------------------------------------------------------------
269 272
270 ProtocolHandlerRegistry::Delegate::~Delegate() { 273 ProtocolHandlerRegistry::Delegate::~Delegate() {
271 } 274 }
272 275
273 void ProtocolHandlerRegistry::Delegate::RegisterExternalHandler( 276 void ProtocolHandlerRegistry::Delegate::RegisterExternalHandler(
274 const std::string& protocol) { 277 const std::string& protocol) {
275 ChildProcessSecurityPolicy* policy = 278 ChildProcessSecurityPolicy* policy =
276 ChildProcessSecurityPolicy::GetInstance(); 279 ChildProcessSecurityPolicy::GetInstance();
277 if (!policy->IsWebSafeScheme(protocol)) { 280 if (!policy->IsWebSafeScheme(protocol)) {
278 policy->RegisterWebSafeScheme(protocol); 281 policy->RegisterWebSafeScheme(protocol);
279 } 282 }
280 net::URLRequest::RegisterProtocolFactory(protocol, 283 net::URLRequest::RegisterProtocolFactory(protocol,
281 &ProtocolHandlerRegistry::Factory); 284 &ProtocolHandlerRegistry::Factory);
282 } 285 }
283 286
284 void ProtocolHandlerRegistry::Delegate::DeregisterExternalHandler( 287 void ProtocolHandlerRegistry::Delegate::DeregisterExternalHandler(
285 const std::string& protocol) { 288 const std::string& protocol) {
286 net::URLRequest::RegisterProtocolFactory(protocol, NULL); 289 net::URLRequest::RegisterProtocolFactory(protocol, NULL);
287 } 290 }
288 291
289 bool ProtocolHandlerRegistry::Delegate::IsExternalHandlerRegistered( 292 bool ProtocolHandlerRegistry::Delegate::IsExternalHandlerRegistered(
290 const std::string& protocol) { 293 const std::string& protocol) {
291 return net::URLRequest::IsHandledProtocol(protocol); 294 return net::URLRequest::IsHandledProtocol(protocol);
292 } 295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698