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

Unified Diff: content/browser/service_worker/service_worker_client_utils.cc

Issue 2420733002: Bring Chrome to the front when opening a URL from a notification (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_client_utils.cc
diff --git a/content/browser/service_worker/service_worker_client_utils.cc b/content/browser/service_worker/service_worker_client_utils.cc
index 0cd39b270e3128d090b5857de356e7bb2917d231..3e791236cde0ab92dcfac176fa85b370c5e0da67 100644
--- a/content/browser/service_worker/service_worker_client_utils.cc
+++ b/content/browser/service_worker/service_worker_client_utils.cc
@@ -162,6 +162,13 @@ void DidOpenURLOnUI(const OpenURLCallback& callback,
return;
}
+ // On Mac, ContentBrowserClient::OpenURL calls ui::BaseWindow::Show which
+ // makes the destination window the main+key window, but won't make Chrome
+ // the active application (https://crbug.com/470830). Since OpenWindow is
+ // always called from a user gesture (e.g. notification click), we should
+ // explicitly activate the window, which brings Chrome to the front.
+ static_cast<WebContentsImpl*>(web_contents)->Activate();
Avi (use Gerrit) 2016/10/13 20:56:15 web_contents->delegate()->ActivateContents(web_con
Avi (use Gerrit) 2016/10/13 21:28:59 Actually, we're in content here so it doesn't matt
+
RenderFrameHostImpl* rfhi =
static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame());
new OpenURLObserver(web_contents,
« 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