Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / browser / loader / resource_dispatcher_host_impl.cc
index 9234315..c5e067d 100644 (file)
@@ -23,6 +23,7 @@
 #include "base/metrics/sparse_histogram.h"
 #include "base/stl_util.h"
 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
+#include "content/browser/appcache/appcache_interceptor.h"
 #include "content/browser/appcache/chrome_appcache_service.h"
 #include "content/browser/cert_store_impl.h"
 #include "content/browser/child_process_security_policy_impl.h"
@@ -87,7 +88,6 @@
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_context.h"
 #include "net/url_request/url_request_job_factory.h"
-#include "webkit/browser/appcache/appcache_interceptor.h"
 #include "webkit/common/blob/blob_data.h"
 #include "webkit/browser/blob/blob_data_handle.h"
 #include "webkit/browser/blob/blob_storage_context.h"
@@ -679,8 +679,15 @@ bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader,
   if (job_factory->IsHandledURL(url))
     return false;
 
-  return delegate_->HandleExternalProtocol(url, info->GetChildID(),
-                                           info->GetRouteID());
+  bool initiated_by_user_gesture =
+      (loader->request()->load_flags() & net::LOAD_MAYBE_USER_GESTURE) != 0;
+  bool handled = delegate_->HandleExternalProtocol(url, info->GetChildID(),
+                                                   info->GetRouteID(),
+                                                   initiated_by_user_gesture);
+  // Consume the user gesture if the external protocol dialog is shown.
+  if (handled)
+    last_user_gesture_time_ = base::TimeTicks();
+  return handled;
 }
 
 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) {
@@ -797,7 +804,7 @@ void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) {
 
 void ResourceDispatcherHostImpl::OnInit() {
   scheduler_.reset(new ResourceScheduler);
-  appcache::AppCacheInterceptor::EnsureRegistered();
+  AppCacheInterceptor::EnsureRegistered();
 }
 
 void ResourceDispatcherHostImpl::OnShutdown() {
@@ -958,7 +965,7 @@ void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
     }
   }
 
-  appcache::AppCacheInterceptor::CompleteCrossSiteTransfer(
+  AppCacheInterceptor::CompleteCrossSiteTransfer(
       loader->request(),
       child_id,
       request_data.appcache_host_id);
@@ -1137,7 +1144,7 @@ void ResourceDispatcherHostImpl::BeginRequest(
       request_data.resource_type);
 
   // Have the appcache associate its extra info with the request.
-  appcache::AppCacheInterceptor::SetExtraRequestInfo(
+  AppCacheInterceptor::SetExtraRequestInfo(
       new_request.get(), filter_->appcache_service(), child_id,
       request_data.appcache_host_id, request_data.resource_type);