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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 1411243012: Activate windows opened via Service Worker Clients.openWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698