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

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

Issue 152143003: [ProtocolHandlers] Add a permission bubble client for RPH requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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/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/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" 14 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h"
15 #include "chrome/browser/net/chrome_url_request_context.h" 15 #include "chrome/browser/net/chrome_url_request_context.h"
16 #include "chrome/browser/profiles/profile_io_data.h" 16 #include "chrome/browser/profiles/profile_io_data.h"
17 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/custom_handlers/protocol_handler.h" 19 #include "chrome/common/custom_handlers/protocol_handler.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "components/user_prefs/pref_registry_syncable.h" 21 #include "components/user_prefs/pref_registry_syncable.h"
21 #include "content/public/browser/child_process_security_policy.h" 22 #include "content/public/browser/child_process_security_policy.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
23 #include "net/base/network_delegate.h" 24 #include "net/base/network_delegate.h"
24 #include "net/url_request/url_request_redirect_job.h" 25 #include "net/url_request/url_request_redirect_job.h"
25 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
26 27
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 326
326 if (!enabled() || IsRegistered(handler) || HasIgnoredEquivalent(handler)) 327 if (!enabled() || IsRegistered(handler) || HasIgnoredEquivalent(handler))
327 return true; 328 return true;
328 329
329 if (AttemptReplace(handler)) 330 if (AttemptReplace(handler))
330 return true; 331 return true;
331 332
332 return false; 333 return false;
333 } 334 }
334 335
336 void ProtocolHandlerRegistry::RequestPermission(
337 content::WebContents* web_contents,
338 const ProtocolHandler& handler) {
339 if (PermissionBubbleManager::Enabled()) {
340 return;
341 }
342
343 RegisterProtocolHandlerInfoBarDelegate::Create(
344 InfoBarService::FromWebContents(web_contents), this, handler);
345 }
346
335 void ProtocolHandlerRegistry::OnAcceptRegisterProtocolHandler( 347 void ProtocolHandlerRegistry::OnAcceptRegisterProtocolHandler(
336 const ProtocolHandler& handler) { 348 const ProtocolHandler& handler) {
337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
338 RegisterProtocolHandler(handler); 350 RegisterProtocolHandler(handler);
339 SetDefault(handler); 351 SetDefault(handler);
340 Save(); 352 Save();
341 NotifyChanged(); 353 NotifyChanged();
342 } 354 }
343 355
344 void ProtocolHandlerRegistry::OnDenyRegisterProtocolHandler( 356 void ProtocolHandlerRegistry::OnDenyRegisterProtocolHandler(
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 891
880 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> 892 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
881 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { 893 ProtocolHandlerRegistry::CreateJobInterceptorFactory() {
882 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 894 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
883 // this is always created on the UI thread (in profile_io's 895 // this is always created on the UI thread (in profile_io's
884 // InitializeOnUIThread. Any method calls must be done 896 // InitializeOnUIThread. Any method calls must be done
885 // on the IO thread (this is checked). 897 // on the IO thread (this is checked).
886 return scoped_ptr<JobInterceptorFactory>( 898 return scoped_ptr<JobInterceptorFactory>(
887 new JobInterceptorFactory(io_thread_delegate_.get())); 899 new JobInterceptorFactory(io_thread_delegate_.get()));
888 } 900 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698