OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 #include "content/public/browser/navigation_entry.h" | 8 #include "content/public/browser/navigation_entry.h" |
9 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 9 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
10 #include "content/public/browser/resource_throttle.h" | 10 #include "content/public/browser/resource_throttle.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (should_wait_for_navigation) | 203 if (should_wait_for_navigation) |
204 load_observer.Wait(); | 204 load_observer.Wait(); |
205 } | 205 } |
206 | 206 |
207 void SetUpCommandLine(base::CommandLine* command_line) override { | 207 void SetUpCommandLine(base::CommandLine* command_line) override { |
208 // Use --site-per-process to force process swaps for cross-site transfers. | 208 // Use --site-per-process to force process swaps for cross-site transfers. |
209 command_line->AppendSwitch(switches::kSitePerProcess); | 209 command_line->AppendSwitch(switches::kSitePerProcess); |
210 } | 210 } |
211 | 211 |
212 void InjectResourceDisptcherHostDelegate() { | 212 void InjectResourceDisptcherHostDelegate() { |
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 213 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
214 old_delegate_ = ResourceDispatcherHostImpl::Get()->delegate(); | 214 old_delegate_ = ResourceDispatcherHostImpl::Get()->delegate(); |
215 ResourceDispatcherHostImpl::Get()->SetDelegate(&tracking_delegate_); | 215 ResourceDispatcherHostImpl::Get()->SetDelegate(&tracking_delegate_); |
216 } | 216 } |
217 | 217 |
218 void RestoreResourceDisptcherHostDelegate() { | 218 void RestoreResourceDisptcherHostDelegate() { |
219 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 219 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
220 ResourceDispatcherHostImpl::Get()->SetDelegate(old_delegate_); | 220 ResourceDispatcherHostImpl::Get()->SetDelegate(old_delegate_); |
221 old_delegate_ = NULL; | 221 old_delegate_ = NULL; |
222 } | 222 } |
223 | 223 |
224 TrackingResourceDispatcherHostDelegate& tracking_delegate() { | 224 TrackingResourceDispatcherHostDelegate& tracking_delegate() { |
225 return tracking_delegate_; | 225 return tracking_delegate_; |
226 } | 226 } |
227 | 227 |
228 private: | 228 private: |
229 TrackingResourceDispatcherHostDelegate tracking_delegate_; | 229 TrackingResourceDispatcherHostDelegate tracking_delegate_; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | 441 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); |
442 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL()); | 442 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL()); |
443 | 443 |
444 // Make sure the request for url2 did not complete. | 444 // Make sure the request for url2 did not complete. |
445 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()); | 445 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()); |
446 | 446 |
447 shell()->web_contents()->SetDelegate(old_delegate); | 447 shell()->web_contents()->SetDelegate(old_delegate); |
448 } | 448 } |
449 | 449 |
450 } // namespace content | 450 } // namespace content |
OLD | NEW |