| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/service_worker/service_worker_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 int frame_tree_node_id_; | 230 int frame_tree_node_id_; |
| 231 const OpenURLCallback callback_; | 231 const OpenURLCallback callback_; |
| 232 | 232 |
| 233 DISALLOW_COPY_AND_ASSIGN(OpenURLObserver); | 233 DISALLOW_COPY_AND_ASSIGN(OpenURLObserver); |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 // This is only called for main frame navigations in OpenWindowOnUI(). | 236 // This is only called for main frame navigations in OpenWindowOnUI(). |
| 237 void DidOpenURL(const OpenURLCallback& callback, WebContents* web_contents) { | 237 void DidOpenURL(const OpenURLCallback& callback, WebContents* web_contents) { |
| 238 DCHECK(web_contents); | 238 DCHECK(web_contents); |
| 239 WebContentsImpl* web_contents_impl = |
| 240 static_cast<WebContentsImpl*>(web_contents); |
| 241 // On Mac, if there are no Chrome windows open, ContentBrowserClient::OpenURL |
| 242 // will call ui::BaseWindow::Show which opens a new window and makes it the |
| 243 // main+key Chrome window, but won't raise it on top of other apps |
| 244 // (https://crbug.com/470830). Since openWindow is always called from a user |
| 245 // gesture (e.g. notification click), we should additionally raise the window. |
| 246 web_contents_impl->Activate(); |
| 239 | 247 |
| 240 RenderFrameHostImpl* rfhi = | 248 RenderFrameHostImpl* rfhi = |
| 241 static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame()); | 249 static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame()); |
| 242 new OpenURLObserver(web_contents, | 250 new OpenURLObserver(web_contents, |
| 243 rfhi->frame_tree_node()->frame_tree_node_id(), callback); | 251 rfhi->frame_tree_node()->frame_tree_node_id(), callback); |
| 244 } | 252 } |
| 245 | 253 |
| 246 void NavigateClientOnUI(const GURL& url, | 254 void NavigateClientOnUI(const GURL& url, |
| 247 const GURL& script_url, | 255 const GURL& script_url, |
| 248 int process_id, | 256 int process_id, |
| (...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 void ServiceWorkerVersion::OnBeginEvent() { | 2396 void ServiceWorkerVersion::OnBeginEvent() { |
| 2389 if (should_exclude_from_uma_ || running_status() != RUNNING || | 2397 if (should_exclude_from_uma_ || running_status() != RUNNING || |
| 2390 idle_time_.is_null()) { | 2398 idle_time_.is_null()) { |
| 2391 return; | 2399 return; |
| 2392 } | 2400 } |
| 2393 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - | 2401 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - |
| 2394 idle_time_); | 2402 idle_time_); |
| 2395 } | 2403 } |
| 2396 | 2404 |
| 2397 } // namespace content | 2405 } // namespace content |
| OLD | NEW |