diff options
8 files changed, 26 insertions, 28 deletions
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc index b0f8e9a..387c3b9 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc @@ -115,12 +115,13 @@ content::ResourceDispatcherHostLoginDelegate* return new AwLoginDelegate(auth_info, request); } -void AwResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, +bool AwResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, int child_id, int route_id) { // The AwURLRequestJobFactory implementation should ensure this method never // gets called. NOTREACHED(); + return false; } void AwResourceDispatcherHostDelegate::SetOnlyAllowLoadFromCache( diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h index 73fc467..68d2352 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h @@ -38,7 +38,7 @@ class AwResourceDispatcherHostDelegate net::AuthChallengeInfo* auth_info, net::URLRequest* request) OVERRIDE; - virtual void HandleExternalProtocol(const GURL& url, + virtual bool HandleExternalProtocol(const GURL& url, int child_id, int route_id) OVERRIDE; diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc index 4f4174d..601f059 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc @@ -253,11 +253,18 @@ ResourceDispatcherHostLoginDelegate* return CreateLoginPrompt(auth_info, request); } -void ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( +bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( const GURL& url, int child_id, int route_id) { +#if defined(OS_ANDROID) + // Android use a resource throttle to handle external as well as internal + // protocols. + return false; +#else BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); + return true; +#endif } void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h index e6cd898..791aaf6 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h @@ -71,7 +71,7 @@ class ChromeResourceDispatcherHostDelegate net::AuthChallengeInfo* auth_info) OVERRIDE; virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( net::AuthChallengeInfo* auth_info, net::URLRequest* request) OVERRIDE; - virtual void HandleExternalProtocol(const GURL& url, + virtual bool HandleExternalProtocol(const GURL& url, int child_id, int route_id) OVERRIDE; virtual bool ShouldForceDownloadResource( diff --git a/chrome/browser/ui/android/external_protocol_dialog_android.cc b/chrome/browser/ui/android/external_protocol_dialog_android.cc index 6d5673f..6362e6c 100644 --- a/chrome/browser/ui/android/external_protocol_dialog_android.cc +++ b/chrome/browser/ui/android/external_protocol_dialog_android.cc @@ -2,28 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/logging.h" -#include "chrome/browser/component/navigation_interception/intercept_navigation_delegate.h" #include "chrome/browser/external_protocol/external_protocol_handler.h" -#include "chrome/browser/tab_contents/tab_util.h" -#include "content/public/browser/web_contents.h" -using content::WebContents; +#include "base/logging.h" // static void ExternalProtocolHandler::RunExternalProtocolDialog( const GURL& url, int render_process_host_id, int routing_id) { - WebContents* web_contents = tab_util::GetWebContentsByID( - render_process_host_id, routing_id); - if (!web_contents) - return; - navigation_interception::InterceptNavigationDelegate* delegate = - navigation_interception::InterceptNavigationDelegate::Get(web_contents); - if (!delegate) - return; - - // TODO(jknotten): The call to ShouldIgnoreNavigation returns false if there - // are no applications that can handle the given URL. In this case, an error - // page should be displayed to the user. - delegate->ShouldIgnoreNavigation(url, true /* has_user_gesture */ ); + // Chrome on Android uses a throttle-based mechansim to intercept links + // so that the user may choose to run an Android application instead of + // loading the link in the browser. The throttle is also used to handle + // external protocols, so this code should not be reachable. + NOTREACHED(); } diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.cc b/content/browser/renderer_host/resource_dispatcher_host_impl.cc index 894ac63..0a824e5 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc @@ -671,9 +671,8 @@ bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader, if (job_factory->IsHandledURL(url)) return false; - delegate_->HandleExternalProtocol(url, info->GetChildID(), - info->GetRouteID()); - return true; + return delegate_->HandleExternalProtocol(url, info->GetChildID(), + info->GetRouteID()); } void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { diff --git a/content/public/browser/resource_dispatcher_host_delegate.cc b/content/public/browser/resource_dispatcher_host_delegate.cc index 6d7d698..0739a11 100644 --- a/content/public/browser/resource_dispatcher_host_delegate.cc +++ b/content/public/browser/resource_dispatcher_host_delegate.cc @@ -57,9 +57,10 @@ ResourceDispatcherHostLoginDelegate* return NULL; } -void ResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, +bool ResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, int child_id, int route_id) { + return true; } bool ResourceDispatcherHostDelegate::ShouldForceDownloadResource( diff --git a/content/public/browser/resource_dispatcher_host_delegate.h b/content/public/browser/resource_dispatcher_host_delegate.h index 81b7209..4205b2a 100644 --- a/content/public/browser/resource_dispatcher_host_delegate.h +++ b/content/public/browser/resource_dispatcher_host_delegate.h @@ -95,8 +95,10 @@ class CONTENT_EXPORT ResourceDispatcherHostDelegate { virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( net::AuthChallengeInfo* auth_info, net::URLRequest* request); - // Launches the url for the given tab. - virtual void HandleExternalProtocol(const GURL& url, + // Launches the url for the given tab. Returns true if an attempt to handle + // the url was made, e.g. by launching an app. Note that this does not + // guarantee that the app successfully handled it. + virtual bool HandleExternalProtocol(const GURL& url, int child_id, int route_id); |