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 <list> | 5 #include <list> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 (*it)->Resume(); | 87 (*it)->Resume(); |
88 } | 88 } |
89 throttles_.clear(); | 89 throttles_.clear(); |
90 } | 90 } |
91 | 91 |
92 // Constructs a ResourceThrottle if the request for |url| should be held. | 92 // Constructs a ResourceThrottle if the request for |url| should be held. |
93 // | 93 // |
94 // Needs to be invoked on the IO thread. | 94 // Needs to be invoked on the IO thread. |
95 content::ResourceThrottle* CreateResourceThrottle( | 95 content::ResourceThrottle* CreateResourceThrottle( |
96 const GURL& url, | 96 const GURL& url, |
97 ResourceType::Type resource_type) { | 97 ResourceType resource_type) { |
98 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 98 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
99 if (urls_to_delay_.find(url) == urls_to_delay_.end()) | 99 if (urls_to_delay_.find(url) == urls_to_delay_.end()) |
100 return NULL; | 100 return NULL; |
101 | 101 |
102 Throttle* throttle = new Throttle(); | 102 Throttle* throttle = new Throttle(); |
103 throttles_.push_back(throttle->AsWeakPtr()); | 103 throttles_.push_back(throttle->AsWeakPtr()); |
104 return throttle; | 104 return throttle; |
105 } | 105 } |
106 | 106 |
107 private: | 107 private: |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 TestNavigationListener* test_navigation_listener) | 222 TestNavigationListener* test_navigation_listener) |
223 : ChromeResourceDispatcherHostDelegate(prerender_tracker), | 223 : ChromeResourceDispatcherHostDelegate(prerender_tracker), |
224 test_navigation_listener_(test_navigation_listener) { | 224 test_navigation_listener_(test_navigation_listener) { |
225 } | 225 } |
226 virtual ~TestResourceDispatcherHostDelegate() {} | 226 virtual ~TestResourceDispatcherHostDelegate() {} |
227 | 227 |
228 virtual void RequestBeginning( | 228 virtual void RequestBeginning( |
229 net::URLRequest* request, | 229 net::URLRequest* request, |
230 content::ResourceContext* resource_context, | 230 content::ResourceContext* resource_context, |
231 content::AppCacheService* appcache_service, | 231 content::AppCacheService* appcache_service, |
232 ResourceType::Type resource_type, | 232 ResourceType resource_type, |
233 int child_id, | 233 int child_id, |
234 int route_id, | 234 int route_id, |
235 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE { | 235 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE { |
236 ChromeResourceDispatcherHostDelegate::RequestBeginning( | 236 ChromeResourceDispatcherHostDelegate::RequestBeginning( |
237 request, | 237 request, |
238 resource_context, | 238 resource_context, |
239 appcache_service, | 239 appcache_service, |
240 resource_type, | 240 resource_type, |
241 child_id, | 241 child_id, |
242 route_id, | 242 route_id, |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 "extensions/api_test/webnavigation/crash/b.html", | 631 "extensions/api_test/webnavigation/crash/b.html", |
632 embedded_test_server()->port())); | 632 embedded_test_server()->port())); |
633 ui_test_utils::NavigateToURL(browser(), url); | 633 ui_test_utils::NavigateToURL(browser(), url); |
634 | 634 |
635 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 635 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
636 } | 636 } |
637 | 637 |
638 #endif | 638 #endif |
639 | 639 |
640 } // namespace extensions | 640 } // namespace extensions |
OLD | NEW |