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

Side by Side Diff: content/browser/loader/navigation_resource_throttle.cc

Issue 1412113006: Prevent the destruction of WebContents in NavigationThrottle methods (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
OLDNEW
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/loader/navigation_resource_throttle.h" 5 #include "content/browser/loader/navigation_resource_throttle.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "content/browser/frame_host/navigation_handle_impl.h" 8 #include "content/browser/frame_host/navigation_handle_impl.h"
9 #include "content/browser/frame_host/render_frame_host_impl.h" 9 #include "content/browser/frame_host/render_frame_host_impl.h"
10 #include "content/public/browser/resource_context.h" 10 #include "content/public/browser/resource_context.h"
11 #include "content/public/browser/resource_controller.h" 11 #include "content/public/browser/resource_controller.h"
12 #include "content/public/browser/resource_request_info.h" 12 #include "content/public/browser/resource_request_info.h"
13 #include "content/public/common/referrer.h" 13 #include "content/public/common/referrer.h"
14 #include "net/url_request/redirect_info.h" 14 #include "net/url_request/redirect_info.h"
15 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
16 #include "net/url_request/url_request_context.h" 16 #include "net/url_request/url_request_context.h"
17 #include "net/url_request/url_request_job_factory.h" 17 #include "net/url_request/url_request_job_factory.h"
18 #include "ui/base/page_transition_types.h" 18 #include "ui/base/page_transition_types.h"
19 19
20 namespace content { 20 namespace content {
21 21
22 namespace { 22 namespace {
23 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> 23 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)>
24 UIChecksPerformedCallback; 24 UIChecksPerformedCallback;
25 25
26 void SendCheckResultToIOThread(UIChecksPerformedCallback callback, 26 void SendCheckResultToIOThread(UIChecksPerformedCallback callback,
27 NavigationThrottle::ThrottleCheckResult result) { 27 NavigationThrottle::ThrottleCheckResult result) {
28 DCHECK_CURRENTLY_ON(BrowserThread::UI); 28 DCHECK_CURRENTLY_ON(BrowserThread::UI);
29 CHECK(result != NavigationThrottle::DEFER); 29 CHECK(result != NavigationThrottle::DEFER &&
30 result != NavigationThrottle::DESTROYED);
30 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 31 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
31 base::Bind(callback, result)); 32 base::Bind(callback, result));
32 } 33 }
33 34
34 void CheckWillStartRequestOnUIThread(UIChecksPerformedCallback callback, 35 void CheckWillStartRequestOnUIThread(UIChecksPerformedCallback callback,
35 int render_process_id, 36 int render_process_id,
36 int render_frame_host_id, 37 int render_frame_host_id,
37 bool is_post, 38 bool is_post,
38 const Referrer& sanitized_referrer, 39 const Referrer& sanitized_referrer,
39 bool has_user_gesture, 40 bool has_user_gesture,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 NavigationThrottle::ThrottleCheckResult result) { 162 NavigationThrottle::ThrottleCheckResult result) {
162 DCHECK_CURRENTLY_ON(BrowserThread::IO); 163 DCHECK_CURRENTLY_ON(BrowserThread::IO);
163 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { 164 if (result == NavigationThrottle::CANCEL_AND_IGNORE) {
164 controller()->CancelAndIgnore(); 165 controller()->CancelAndIgnore();
165 } else { 166 } else {
166 controller()->Resume(); 167 controller()->Resume();
167 } 168 }
168 } 169 }
169 170
170 } // namespace content 171 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_request.cc ('k') | content/public/browser/navigation_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698