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

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

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 } 242 }
243 243
244 void ProtocolHandlerRegistry::Save() { 244 void ProtocolHandlerRegistry::Save() {
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
246 if (is_loading_) { 246 if (is_loading_) {
247 return; 247 return;
248 } 248 }
249 scoped_ptr<Value> registered_protocol_handlers(EncodeRegisteredHandlers()); 249 scoped_ptr<Value> registered_protocol_handlers(EncodeRegisteredHandlers());
250 scoped_ptr<Value> ignored_protocol_handlers(EncodeIgnoredHandlers()); 250 scoped_ptr<Value> ignored_protocol_handlers(EncodeIgnoredHandlers());
251 scoped_ptr<Value> enabled(Value::CreateBooleanValue(enabled_)); 251 scoped_ptr<Value> enabled(base::BooleanValue::New(enabled_));
252 profile_->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers, 252 profile_->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers,
253 *registered_protocol_handlers); 253 *registered_protocol_handlers);
254 profile_->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers, 254 profile_->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers,
255 *ignored_protocol_handlers); 255 *ignored_protocol_handlers);
256 profile_->GetPrefs()->Set(prefs::kCustomHandlersEnabled, *enabled); 256 profile_->GetPrefs()->Set(prefs::kCustomHandlersEnabled, *enabled);
257 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); 257 profile_->GetPrefs()->ScheduleSavePersistentPrefs();
258 } 258 }
259 259
260 bool ProtocolHandlerRegistry::CanSchemeBeOverridden( 260 bool ProtocolHandlerRegistry::CanSchemeBeOverridden(
261 const std::string& scheme) const { 261 const std::string& scheme) const {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 Value* ProtocolHandlerRegistry::EncodeRegisteredHandlers() { 375 Value* ProtocolHandlerRegistry::EncodeRegisteredHandlers() {
376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
377 ListValue* protocol_handlers = new ListValue(); 377 ListValue* protocol_handlers = new ListValue();
378 for (ProtocolHandlerMultiMap::iterator i = protocol_handlers_.begin(); 378 for (ProtocolHandlerMultiMap::iterator i = protocol_handlers_.begin();
379 i != protocol_handlers_.end(); ++i) { 379 i != protocol_handlers_.end(); ++i) {
380 for (ProtocolHandlerList::iterator j = i->second.begin(); 380 for (ProtocolHandlerList::iterator j = i->second.begin();
381 j != i->second.end(); ++j) { 381 j != i->second.end(); ++j) {
382 DictionaryValue* encoded = j->Encode(); 382 DictionaryValue* encoded = j->Encode();
383 if (IsDefault(*j)) { 383 if (IsDefault(*j)) {
384 encoded->Set("default", Value::CreateBooleanValue(true)); 384 encoded->Set("default", base::TrueValue());
385 } 385 }
386 protocol_handlers->Append(encoded); 386 protocol_handlers->Append(encoded);
387 } 387 }
388 } 388 }
389 return protocol_handlers; 389 return protocol_handlers;
390 } 390 }
391 391
392 Value* ProtocolHandlerRegistry::EncodeIgnoredHandlers() { 392 Value* ProtocolHandlerRegistry::EncodeIgnoredHandlers() {
393 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 393 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
394 ListValue* handlers = new ListValue(); 394 ListValue* handlers = new ListValue();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 624 }
625 } else { 625 } else {
626 NOTREACHED(); 626 NOTREACHED();
627 } 627 }
628 } 628 }
629 629
630 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( 630 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker(
631 ShellIntegration::DefaultProtocolClientWorker* worker) { 631 ShellIntegration::DefaultProtocolClientWorker* worker) {
632 worker_ = worker; 632 worker_ = worker;
633 } 633 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698