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

Side by Side Diff: chrome/browser/automation/automation_resource_message_filter.cc

Issue 386008: ChromeFrame HTTP requests would randomly fail if we navigated to multiple HTT... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "chrome/browser/automation/automation_resource_message_filter.h" 5 #include "chrome/browser/automation/automation_resource_message_filter.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "chrome/browser/automation/url_request_automation_job.h" 9 #include "chrome/browser/automation/url_request_automation_job.h"
10 #include "chrome/browser/net/url_request_failed_dns_job.h" 10 #include "chrome/browser/net/url_request_failed_dns_job.h"
11 #include "chrome/browser/net/url_request_mock_http_job.h" 11 #include "chrome/browser/net/url_request_mock_http_job.h"
12 #include "chrome/browser/net/url_request_mock_util.h" 12 #include "chrome/browser/net/url_request_mock_util.h"
13 #include "chrome/browser/net/url_request_slow_download_job.h" 13 #include "chrome/browser/net/url_request_slow_download_job.h"
14 #include "chrome/browser/net/url_request_slow_http_job.h" 14 #include "chrome/browser/net/url_request_slow_http_job.h"
15 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/browser/chrome_thread.h" 16 #include "chrome/browser/chrome_thread.h"
17 #include "chrome/test/automation/automation_messages.h" 17 #include "chrome/test/automation/automation_messages.h"
18 #include "net/url_request/url_request_filter.h" 18 #include "net/url_request/url_request_filter.h"
19 19
20 20
21 AutomationResourceMessageFilter::RenderViewMap 21 AutomationResourceMessageFilter::RenderViewMap
22 AutomationResourceMessageFilter::filtered_render_views_; 22 AutomationResourceMessageFilter::filtered_render_views_;
23 23
24 int AutomationResourceMessageFilter::unique_request_id_ = 1;
25
24 AutomationResourceMessageFilter::AutomationResourceMessageFilter() 26 AutomationResourceMessageFilter::AutomationResourceMessageFilter()
25 : channel_(NULL) { 27 : channel_(NULL) {
26 ChromeThread::PostTask( 28 ChromeThread::PostTask(
27 ChromeThread::IO, FROM_HERE, 29 ChromeThread::IO, FROM_HERE,
28 NewRunnableFunction( 30 NewRunnableFunction(
29 URLRequestAutomationJob::EnsureProtocolFactoryRegistered)); 31 URLRequestAutomationJob::EnsureProtocolFactoryRegistered));
30 } 32 }
31 33
32 AutomationResourceMessageFilter::~AutomationResourceMessageFilter() { 34 AutomationResourceMessageFilter::~AutomationResourceMessageFilter() {
33 } 35 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 renderer_pid, renderer_id)); 188 renderer_pid, renderer_id));
187 if (it != filtered_render_views_.end()) { 189 if (it != filtered_render_views_.end()) {
188 found = true; 190 found = true;
189 if (details) 191 if (details)
190 *details = it->second; 192 *details = it->second;
191 } 193 }
192 194
193 return found; 195 return found;
194 } 196 }
195 197
198 bool AutomationResourceMessageFilter::GetAutomationRequestId(
199 int request_id, int* automation_request_id) {
200 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
201
202 RequestMap::iterator it = request_map_.begin();
203 while (it != request_map_.end()) {
204 URLRequestAutomationJob* job = it->second;
205 DCHECK(job);
206 if (job && job->request_id() == request_id) {
207 *automation_request_id = job->id();
208 return true;
209 }
210 it++;
211 }
212
213 return false;
214 }
215
216 bool AutomationResourceMessageFilter::SendDownloadRequestToHost(
217 int routing_id, int tab_handle, int request_id) {
218 int automation_request_id = 0;
219 bool valid_id = GetAutomationRequestId(request_id, &automation_request_id);
220 if (!valid_id) {
221 NOTREACHED() << "Invalid request id: " << request_id;
222 return false;
223 }
224
225 return Send(new AutomationMsg_DownloadRequestInHost(0, tab_handle,
226 automation_request_id));
227 }
228
196 void AutomationResourceMessageFilter::OnSetFilteredInet(bool enable) { 229 void AutomationResourceMessageFilter::OnSetFilteredInet(bool enable) {
197 chrome_browser_net::SetUrlRequestMocksEnabled(enable); 230 chrome_browser_net::SetUrlRequestMocksEnabled(enable);
198 } 231 }
199 232
200 void AutomationResourceMessageFilter::OnGetFilteredInetHitCount( 233 void AutomationResourceMessageFilter::OnGetFilteredInetHitCount(
201 int* hit_count) { 234 int* hit_count) {
202 *hit_count = URLRequestFilter::GetInstance()->hit_count(); 235 *hit_count = URLRequestFilter::GetInstance()->hit_count();
203 } 236 }
204 237
205 void AutomationResourceMessageFilter::OnRecordHistograms( 238 void AutomationResourceMessageFilter::OnRecordHistograms(
206 const std::vector<std::string>& histogram_list) { 239 const std::vector<std::string>& histogram_list) {
207 for (size_t index = 0; index < histogram_list.size(); ++index) { 240 for (size_t index = 0; index < histogram_list.size(); ++index) {
208 Histogram::DeserializeHistogramInfo(histogram_list[index]); 241 Histogram::DeserializeHistogramInfo(histogram_list[index]);
209 } 242 }
210 } 243 }
211 244
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_resource_message_filter.h ('k') | chrome/browser/automation/url_request_automation_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698