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

Side by Side Diff: chrome/browser/plugin_process_host.cc

Issue 258008: Move initialization of ChromeURLRequestContexts to the IO thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again, just in case Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/url_request_context_getter.cc ('k') | chrome/browser/profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/plugin_process_host.h" 7 #include "chrome/browser/plugin_process_host.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 16 matching lines...) Expand all
27 #include "base/scoped_ptr.h" 27 #include "base/scoped_ptr.h"
28 #include "base/string_util.h" 28 #include "base/string_util.h"
29 #include "base/thread.h" 29 #include "base/thread.h"
30 #include "chrome/browser/browser.h" 30 #include "chrome/browser/browser.h"
31 #include "chrome/browser/browser_list.h" 31 #include "chrome/browser/browser_list.h"
32 #include "chrome/browser/browser_process.h" 32 #include "chrome/browser/browser_process.h"
33 #include "chrome/browser/browser_window.h" 33 #include "chrome/browser/browser_window.h"
34 #include "chrome/browser/child_process_security_policy.h" 34 #include "chrome/browser/child_process_security_policy.h"
35 #include "chrome/browser/chrome_plugin_browsing_context.h" 35 #include "chrome/browser/chrome_plugin_browsing_context.h"
36 #include "chrome/browser/chrome_thread.h" 36 #include "chrome/browser/chrome_thread.h"
37 #include "chrome/browser/net/url_request_context_getter.h"
37 #include "chrome/browser/net/url_request_tracking.h" 38 #include "chrome/browser/net/url_request_tracking.h"
38 #include "chrome/browser/plugin_service.h" 39 #include "chrome/browser/plugin_service.h"
39 #include "chrome/browser/profile.h" 40 #include "chrome/browser/profile.h"
40 #include "chrome/browser/renderer_host/browser_render_process_host.h" 41 #include "chrome/browser/renderer_host/browser_render_process_host.h"
41 #include "chrome/browser/renderer_host/render_process_host.h" 42 #include "chrome/browser/renderer_host/render_process_host.h"
42 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 43 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
43 #include "chrome/common/chrome_paths.h" 44 #include "chrome/common/chrome_paths.h"
44 #include "chrome/common/chrome_plugin_lib.h" 45 #include "chrome/common/chrome_plugin_lib.h"
45 #include "chrome/common/chrome_switches.h" 46 #include "chrome/common/chrome_switches.h"
46 #include "chrome/common/logging_chrome.h" 47 #include "chrome/common/logging_chrome.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if (download_file_request_) { 143 if (download_file_request_) {
143 delete download_file_request_; 144 delete download_file_request_;
144 download_file_request_ = NULL; 145 download_file_request_ = NULL;
145 } 146 }
146 } 147 }
147 148
148 void PluginDownloadUrlHelper::InitiateDownload() { 149 void PluginDownloadUrlHelper::InitiateDownload() {
149 download_file_request_ = new URLRequest(GURL(download_url_), this); 150 download_file_request_ = new URLRequest(GURL(download_url_), this);
150 chrome_browser_net::SetOriginProcessUniqueIDForRequest( 151 chrome_browser_net::SetOriginProcessUniqueIDForRequest(
151 download_source_child_unique_id_, download_file_request_); 152 download_source_child_unique_id_, download_file_request_);
152 download_file_request_->set_context(Profile::GetDefaultRequestContext()); 153 download_file_request_->set_context(
154 Profile::GetDefaultRequestContext()->GetURLRequestContext());
153 download_file_request_->Start(); 155 download_file_request_->Start();
154 } 156 }
155 157
156 void PluginDownloadUrlHelper::OnAuthRequired( 158 void PluginDownloadUrlHelper::OnAuthRequired(
157 URLRequest* request, 159 URLRequest* request,
158 net::AuthChallengeInfo* auth_info) { 160 net::AuthChallengeInfo* auth_info) {
159 URLRequest::Delegate::OnAuthRequired(request, auth_info); 161 URLRequest::Delegate::OnAuthRequired(request, auth_info);
160 DownloadCompletedHelper(false); 162 DownloadCompletedHelper(false);
161 } 163 }
162 164
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 RequestPluginChannel(renderer_message_filter, mime_type, reply_msg); 558 RequestPluginChannel(renderer_message_filter, mime_type, reply_msg);
557 } 559 }
558 560
559 void PluginProcessHost::OnGetCookies(uint32 request_context, 561 void PluginProcessHost::OnGetCookies(uint32 request_context,
560 const GURL& url, 562 const GURL& url,
561 std::string* cookies) { 563 std::string* cookies) {
562 URLRequestContext* context = CPBrowsingContextManager::Instance()-> 564 URLRequestContext* context = CPBrowsingContextManager::Instance()->
563 ToURLRequestContext(request_context); 565 ToURLRequestContext(request_context);
564 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. 566 // TODO(mpcomplete): remove fallback case when Gears support is prevalent.
565 if (!context) 567 if (!context)
566 context = Profile::GetDefaultRequestContext(); 568 context = Profile::GetDefaultRequestContext()->GetURLRequestContext();
567 569
568 // Note: We don't have a first_party_for_cookies check because plugins bypass 570 // Note: We don't have a first_party_for_cookies check because plugins bypass
569 // third-party cookie blocking. 571 // third-party cookie blocking.
570 if (context && context->cookie_store()) { 572 if (context && context->cookie_store()) {
571 *cookies = context->cookie_store()->GetCookies(url); 573 *cookies = context->cookie_store()->GetCookies(url);
572 } else { 574 } else {
573 DLOG(ERROR) << "Could not serve plugin cookies request."; 575 DLOG(ERROR) << "Could not serve plugin cookies request.";
574 *cookies = EmptyString(); 576 *cookies = EmptyString();
575 } 577 }
576 } 578 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 DCHECK(MessageLoop::current() == 673 DCHECK(MessageLoop::current() ==
672 ChromeThread::GetMessageLoop(ChromeThread::IO)); 674 ChromeThread::GetMessageLoop(ChromeThread::IO));
673 675
674 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 676 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
675 if (chrome_plugin) { 677 if (chrome_plugin) {
676 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 678 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
677 uint32 data_len = static_cast<uint32>(data.size()); 679 uint32 data_len = static_cast<uint32>(data.size());
678 chrome_plugin->functions().on_message(data_ptr, data_len); 680 chrome_plugin->functions().on_message(data_ptr, data_len);
679 } 681 }
680 } 682 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_request_context_getter.cc ('k') | chrome/browser/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698