OLD | NEW |
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/external_protocol/external_protocol_handler.h" | 5 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Set in the stored prefs. | 226 // Set in the stored prefs. |
227 // TODO(pkasting): http://b/1119651 This kind of thing should go in the | 227 // TODO(pkasting): http://b/1119651 This kind of thing should go in the |
228 // preferences on the profile, not in the local state. | 228 // preferences on the profile, not in the local state. |
229 PrefService* pref = g_browser_process->local_state(); | 229 PrefService* pref = g_browser_process->local_state(); |
230 if (pref) { // May be NULL during testing. | 230 if (pref) { // May be NULL during testing. |
231 DictionaryPrefUpdate update_excluded_schemas(pref, prefs::kExcludedSchemes); | 231 DictionaryPrefUpdate update_excluded_schemas(pref, prefs::kExcludedSchemes); |
232 | 232 |
233 if (state == UNKNOWN) { | 233 if (state == UNKNOWN) { |
234 update_excluded_schemas->Remove(scheme, NULL); | 234 update_excluded_schemas->Remove(scheme, NULL); |
235 } else { | 235 } else { |
236 update_excluded_schemas->SetBoolean(scheme, | 236 update_excluded_schemas->SetBoolean(scheme, (state == BLOCK)); |
237 state == BLOCK ? true : false); | |
238 } | 237 } |
239 } | 238 } |
240 } | 239 } |
241 | 240 |
242 // static | 241 // static |
243 void ExternalProtocolHandler::LaunchUrlWithDelegate(const GURL& url, | 242 void ExternalProtocolHandler::LaunchUrlWithDelegate(const GURL& url, |
244 int render_process_host_id, | 243 int render_process_host_id, |
245 int tab_contents_id, | 244 int tab_contents_id, |
246 Delegate* delegate) { | 245 Delegate* delegate) { |
247 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 246 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // static | 295 // static |
297 void ExternalProtocolHandler::RegisterPrefs(PrefService* prefs) { | 296 void ExternalProtocolHandler::RegisterPrefs(PrefService* prefs) { |
298 prefs->RegisterDictionaryPref(prefs::kExcludedSchemes); | 297 prefs->RegisterDictionaryPref(prefs::kExcludedSchemes); |
299 } | 298 } |
300 | 299 |
301 // static | 300 // static |
302 void ExternalProtocolHandler::PermitLaunchUrl() { | 301 void ExternalProtocolHandler::PermitLaunchUrl() { |
303 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 302 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
304 g_accept_requests = true; | 303 g_accept_requests = true; |
305 } | 304 } |
OLD | NEW |