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

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

Issue 897673002: First step in enabling creating tabs without an Activity on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a-base-mounir
Patch Set: s/NavigationUtils/ServiceTabCreator/g Created 5 years, 10 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 unified diff | Download patch
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 render_frame_id)); 203 render_frame_id));
204 Observe(nullptr); 204 Observe(nullptr);
205 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 205 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
206 } 206 }
207 207
208 const WindowOpenedCallback callback_; 208 const WindowOpenedCallback callback_;
209 209
210 DISALLOW_COPY_AND_ASSIGN(WindowOpenedObserver); 210 DISALLOW_COPY_AND_ASSIGN(WindowOpenedObserver);
211 }; 211 };
212 212
213 void DidOpenWindowOnUI(
214 const WindowOpenedCallback& callback, WebContents* web_contents) {
215 DCHECK(web_contents);
216
217 new WindowOpenedObserver(web_contents, callback);
218 }
219
213 void OpenWindowOnUI( 220 void OpenWindowOnUI(
214 const GURL& url, 221 const GURL& url,
215 const GURL& script_url, 222 const GURL& script_url,
216 int process_id, 223 int process_id,
217 const scoped_refptr<ServiceWorkerContextWrapper>& context_wrapper, 224 const scoped_refptr<ServiceWorkerContextWrapper>& context_wrapper,
218 const WindowOpenedCallback& callback) { 225 const WindowOpenedCallback& callback) {
219 DCHECK_CURRENTLY_ON(BrowserThread::UI); 226 DCHECK_CURRENTLY_ON(BrowserThread::UI);
220 227
221 BrowserContext* browser_context = context_wrapper->storage_partition() 228 BrowserContext* browser_context = context_wrapper->storage_partition()
222 ? context_wrapper->storage_partition()->browser_context() 229 ? context_wrapper->storage_partition()->browser_context()
(...skipping 11 matching lines...) Expand all
234 MSG_ROUTING_NONE)); 241 MSG_ROUTING_NONE));
235 return; 242 return;
236 } 243 }
237 244
238 OpenURLParams params(url, 245 OpenURLParams params(url,
239 Referrer(script_url, blink::WebReferrerPolicyDefault), 246 Referrer(script_url, blink::WebReferrerPolicyDefault),
240 NEW_FOREGROUND_TAB, 247 NEW_FOREGROUND_TAB,
241 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 248 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
242 false); 249 false);
243 250
244 WebContents* web_contents = 251 GetContentClient()->browser()->OpenURL(
245 GetContentClient()->browser()->OpenURL(browser_context, params); 252 browser_context, params,
246 DCHECK(web_contents); 253 base::Bind(&DidOpenWindowOnUI, callback));
247
248 new WindowOpenedObserver(web_contents, callback);
249 } 254 }
250 255
251 void KillEmbeddedWorkerProcess(int process_id, ResultCode code) { 256 void KillEmbeddedWorkerProcess(int process_id, ResultCode code) {
252 DCHECK_CURRENTLY_ON(BrowserThread::UI); 257 DCHECK_CURRENTLY_ON(BrowserThread::UI);
253 258
254 RenderProcessHost* render_process_host = 259 RenderProcessHost* render_process_host =
255 RenderProcessHost::FromID(process_id); 260 RenderProcessHost::FromID(process_id);
256 if (render_process_host->GetHandle() != base::kNullProcessHandle) 261 if (render_process_host->GetHandle() != base::kNullProcessHandle)
257 render_process_host->ReceivedBadMessage(); 262 render_process_host->ReceivedBadMessage();
258 } 263 }
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 int request_id) { 1355 int request_id) {
1351 callbacks->Remove(request_id); 1356 callbacks->Remove(request_id);
1352 if (is_doomed_) { 1357 if (is_doomed_) {
1353 // The stop should be already scheduled, but try to stop immediately, in 1358 // The stop should be already scheduled, but try to stop immediately, in
1354 // order to release worker resources soon. 1359 // order to release worker resources soon.
1355 StopWorkerIfIdle(); 1360 StopWorkerIfIdle();
1356 } 1361 }
1357 } 1362 }
1358 1363
1359 } // namespace content 1364 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698