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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 9433006: Remove GetAudioManager and GetMediaStreamManager from ResourceContext. The reason is the content mo… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 10 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
OLDNEW
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 "chrome/browser/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 24 matching lines...) Expand all
35 #include "chrome/browser/prefs/pref_service.h" 35 #include "chrome/browser/prefs/pref_service.h"
36 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
37 #include "chrome/browser/profiles/profile_manager.h" 37 #include "chrome/browser/profiles/profile_manager.h"
38 #include "chrome/browser/transport_security_persister.h" 38 #include "chrome/browser/transport_security_persister.h"
39 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 39 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
40 #include "chrome/common/chrome_notification_types.h" 40 #include "chrome/common/chrome_notification_types.h"
41 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
42 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
43 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
44 #include "content/browser/in_process_webkit/webkit_context.h" 44 #include "content/browser/in_process_webkit/webkit_context.h"
45 #include "content/browser/renderer_host/media/media_stream_manager.h"
46 #include "content/browser/renderer_host/resource_dispatcher_host.h" 45 #include "content/browser/renderer_host/resource_dispatcher_host.h"
47 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 46 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
48 #include "content/public/browser/browser_thread.h" 47 #include "content/public/browser/browser_thread.h"
49 #include "content/public/browser/host_zoom_map.h" 48 #include "content/public/browser/host_zoom_map.h"
50 #include "content/public/browser/notification_service.h" 49 #include "content/public/browser/notification_service.h"
51 #include "content/public/browser/resource_context.h" 50 #include "content/public/browser/resource_context.h"
52 #include "media/audio/audio_manager.h"
53 #include "net/base/origin_bound_cert_service.h" 51 #include "net/base/origin_bound_cert_service.h"
54 #include "net/http/http_transaction_factory.h" 52 #include "net/http/http_transaction_factory.h"
55 #include "net/http/http_util.h" 53 #include "net/http/http_util.h"
56 #include "net/proxy/proxy_config_service_fixed.h" 54 #include "net/proxy/proxy_config_service_fixed.h"
57 #include "net/proxy/proxy_script_fetcher_impl.h" 55 #include "net/proxy/proxy_script_fetcher_impl.h"
58 #include "net/proxy/proxy_service.h" 56 #include "net/proxy/proxy_service.h"
59 #include "net/url_request/url_request.h" 57 #include "net/url_request/url_request.h"
60 #include "webkit/blob/blob_data.h" 58 #include "webkit/blob/blob_data.h"
61 #include "webkit/blob/blob_url_request_job_factory.h" 59 #include "webkit/blob/blob_url_request_job_factory.h"
62 #include "webkit/fileapi/file_system_url_request_job_factory.h" 60 #include "webkit/fileapi/file_system_url_request_job_factory.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // At the moment, it'll remain 'undeterministic' when a user 207 // At the moment, it'll remain 'undeterministic' when a user
210 // types a URL in the omnibar or click on a download link in a page. 208 // types a URL in the omnibar or click on a download link in a page.
211 // For the latter, we need a change on the webkit-side. 209 // For the latter, we need a change on the webkit-side.
212 // We initialize it to the default charset here and a user will 210 // We initialize it to the default charset here and a user will
213 // have an *arguably* better default charset for interpreting a raw 8bit 211 // have an *arguably* better default charset for interpreting a raw 8bit
214 // C-D header field. It means the native OS codepage fallback in 212 // C-D header field. It means the native OS codepage fallback in
215 // net_util::GetSuggestedFilename is unlikely to be taken. 213 // net_util::GetSuggestedFilename is unlikely to be taken.
216 params->referrer_charset = default_charset; 214 params->referrer_charset = default_charset;
217 215
218 params->io_thread = g_browser_process->io_thread(); 216 params->io_thread = g_browser_process->io_thread();
219 params->audio_manager = g_browser_process->audio_manager();
220 217
221 params->host_content_settings_map = profile->GetHostContentSettingsMap(); 218 params->host_content_settings_map = profile->GetHostContentSettingsMap();
222 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); 219 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile);
223 params->ssl_config_service = profile->GetSSLConfigService(); 220 params->ssl_config_service = profile->GetSSLConfigService();
224 base::Callback<Profile*(void)> profile_getter = 221 base::Callback<Profile*(void)> profile_getter =
225 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), 222 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(),
226 profile); 223 profile);
227 params->cookie_monster_delegate = 224 params->cookie_monster_delegate =
228 new ChromeCookieMonsterDelegate(profile_getter); 225 new ChromeCookieMonsterDelegate(profile_getter);
229 params->extension_info_map = profile->GetExtensionInfoMap(); 226 params->extension_info_map = profile->GetExtensionInfoMap();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 EnsureInitialized(); 408 EnsureInitialized();
412 return request_context_; 409 return request_context_;
413 } 410 }
414 411
415 MediaObserver* ProfileIOData::ResourceContext::GetMediaObserver() { 412 MediaObserver* ProfileIOData::ResourceContext::GetMediaObserver() {
416 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 413 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
417 EnsureInitialized(); 414 EnsureInitialized();
418 return media_observer_; 415 return media_observer_;
419 } 416 }
420 417
421 media_stream::MediaStreamManager*
422 ProfileIOData::ResourceContext::GetMediaStreamManager() {
423 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
424 EnsureInitialized();
425 return media_stream_manager_;
426 }
427
428 AudioManager* ProfileIOData::ResourceContext::GetAudioManager() {
429 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
430 EnsureInitialized();
431 return audio_manager_;
432 }
433
434 void ProfileIOData::LazyInitialize() const { 418 void ProfileIOData::LazyInitialize() const {
435 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 419 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
436 if (initialized_) 420 if (initialized_)
437 return; 421 return;
438 422
439 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 423 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
440 CHECK(initialized_on_UI_thread_); 424 CHECK(initialized_on_UI_thread_);
441 425
442 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. 426 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed.
443 CHECK(profile_params_.get()); 427 CHECK(profile_params_.get());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); 498 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
515 DCHECK(set_protocol); 499 DCHECK(set_protocol);
516 #if defined(OS_CHROMEOS) && !defined(GOOGLE_CHROME_BUILD) 500 #if defined(OS_CHROMEOS) && !defined(GOOGLE_CHROME_BUILD)
517 // Install the GView request interceptor that will redirect requests 501 // Install the GView request interceptor that will redirect requests
518 // of compatible documents (PDF, etc) to the GView document viewer. 502 // of compatible documents (PDF, etc) to the GView document viewer.
519 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 503 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
520 if (parsed_command_line.HasSwitch(switches::kEnableGView)) 504 if (parsed_command_line.HasSwitch(switches::kEnableGView))
521 job_factory_->AddInterceptor(new chromeos::GViewRequestInterceptor); 505 job_factory_->AddInterceptor(new chromeos::GViewRequestInterceptor);
522 #endif // defined(OS_CHROMEOS) && !defined(GOOGLE_CHROME_BUILD) 506 #endif // defined(OS_CHROMEOS) && !defined(GOOGLE_CHROME_BUILD)
523 507
524 media_stream_manager_.reset(
525 new media_stream::MediaStreamManager(profile_params_->audio_manager));
526
527 // Take ownership over these parameters. 508 // Take ownership over these parameters.
528 host_content_settings_map_ = profile_params_->host_content_settings_map; 509 host_content_settings_map_ = profile_params_->host_content_settings_map;
529 cookie_settings_ = profile_params_->cookie_settings; 510 cookie_settings_ = profile_params_->cookie_settings;
530 notification_service_ = profile_params_->notification_service; 511 notification_service_ = profile_params_->notification_service;
531 extension_info_map_ = profile_params_->extension_info_map; 512 extension_info_map_ = profile_params_->extension_info_map;
532 513
533 resource_context_.host_resolver_ = io_thread_globals->host_resolver.get(); 514 resource_context_.host_resolver_ = io_thread_globals->host_resolver.get();
534 resource_context_.request_context_ = main_request_context_; 515 resource_context_.request_context_ = main_request_context_;
535 resource_context_.media_observer_ = 516 resource_context_.media_observer_ =
536 io_thread_globals->media.media_internals.get(); 517 io_thread_globals->media.media_internals.get();
537 resource_context_.media_stream_manager_ = media_stream_manager_.get();
538 resource_context_.audio_manager_ = profile_params_->audio_manager;
539 518
540 LazyInitializeInternal(profile_params_.get()); 519 LazyInitializeInternal(profile_params_.get());
541 520
542 profile_params_.reset(); 521 profile_params_.reset();
543 initialized_ = true; 522 initialized_ = true;
544 } 523 }
545 524
546 void ProfileIOData::ApplyProfileParamsToContext( 525 void ProfileIOData::ApplyProfileParamsToContext(
547 ChromeURLRequestContext* context) const { 526 ChromeURLRequestContext* context) const {
548 context->set_is_incognito(profile_params_->is_incognito); 527 context->set_is_incognito(profile_params_->is_incognito);
(...skipping 21 matching lines...) Expand all
570 &resource_context_)); 549 &resource_context_));
571 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 550 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
572 if (!posted) 551 if (!posted)
573 delete this; 552 delete this;
574 } 553 }
575 554
576 void ProfileIOData::set_origin_bound_cert_service( 555 void ProfileIOData::set_origin_bound_cert_service(
577 net::OriginBoundCertService* origin_bound_cert_service) const { 556 net::OriginBoundCertService* origin_bound_cert_service) const {
578 origin_bound_cert_service_.reset(origin_bound_cert_service); 557 origin_bound_cert_service_.reset(origin_bound_cert_service);
579 } 558 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/browser/speech/chrome_speech_input_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698