OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_client_utils.h" | 5 #include "content/browser/service_worker/service_worker_client_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <tuple> | 8 #include <tuple> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 155 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
156 | 156 |
157 if (!web_contents) { | 157 if (!web_contents) { |
158 BrowserThread::PostTask( | 158 BrowserThread::PostTask( |
159 BrowserThread::IO, FROM_HERE, | 159 BrowserThread::IO, FROM_HERE, |
160 base::Bind(callback, ChildProcessHost::kInvalidUniqueID, | 160 base::Bind(callback, ChildProcessHost::kInvalidUniqueID, |
161 MSG_ROUTING_NONE)); | 161 MSG_ROUTING_NONE)); |
162 return; | 162 return; |
163 } | 163 } |
164 | 164 |
165 // On Mac, ContentBrowserClient::OpenURL calls ui::BaseWindow::Show which | |
166 // makes the destination window the main+key window, but won't make Chrome | |
167 // the active application (https://crbug.com/470830). Since OpenWindow is | |
168 // always called from a user gesture (e.g. notification click), we should | |
169 // explicitly activate the window, which brings Chrome to the front. | |
170 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
| |
171 | |
165 RenderFrameHostImpl* rfhi = | 172 RenderFrameHostImpl* rfhi = |
166 static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame()); | 173 static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame()); |
167 new OpenURLObserver(web_contents, | 174 new OpenURLObserver(web_contents, |
168 rfhi->frame_tree_node()->frame_tree_node_id(), callback); | 175 rfhi->frame_tree_node()->frame_tree_node_id(), callback); |
169 } | 176 } |
170 | 177 |
171 void OpenWindowOnUI( | 178 void OpenWindowOnUI( |
172 const GURL& url, | 179 const GURL& url, |
173 const GURL& script_url, | 180 const GURL& script_url, |
174 int worker_process_id, | 181 int worker_process_id, |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 GetWindowClients(controller, options, callback); | 505 GetWindowClients(controller, options, callback); |
499 return; | 506 return; |
500 } | 507 } |
501 | 508 |
502 GetNonWindowClients(controller, options, &clients); | 509 GetNonWindowClients(controller, options, &clients); |
503 DidGetClients(callback, &clients); | 510 DidGetClients(callback, &clients); |
504 } | 511 } |
505 | 512 |
506 } // namespace service_worker_client_utils | 513 } // namespace service_worker_client_utils |
507 } // namespace content | 514 } // namespace content |
OLD | NEW |