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

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

Issue 143003031: Allow retrieval of media device ID salt even after ResourceContext has gone away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. Created 6 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 sync_disabled_.MoveToThread(io_message_loop_proxy); 412 sync_disabled_.MoveToThread(io_message_loop_proxy);
413 413
414 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); 414 signin_allowed_.Init(prefs::kSigninAllowed, pref_service);
415 signin_allowed_.MoveToThread(io_message_loop_proxy); 415 signin_allowed_.MoveToThread(io_message_loop_proxy);
416 } 416 }
417 417
418 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, 418 quick_check_enabled_.Init(prefs::kQuickCheckEnabled,
419 local_state_pref_service); 419 local_state_pref_service);
420 quick_check_enabled_.MoveToThread(io_message_loop_proxy); 420 quick_check_enabled_.MoveToThread(io_message_loop_proxy);
421 421
422 media_device_id_salt_.reset(new MediaDeviceIDSalt(pref_service, 422 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, is_incognito());
423 is_incognito()));
424 423
425 network_prediction_enabled_.Init(prefs::kNetworkPredictionEnabled, 424 network_prediction_enabled_.Init(prefs::kNetworkPredictionEnabled,
426 pref_service); 425 pref_service);
427 network_prediction_enabled_.MoveToThread(io_message_loop_proxy); 426 network_prediction_enabled_.MoveToThread(io_message_loop_proxy);
428 427
429 #if defined(OS_CHROMEOS) 428 #if defined(OS_CHROMEOS)
430 cert_verifier_ = policy::PolicyCertServiceFactory::CreateForProfile(profile); 429 cert_verifier_ = policy::PolicyCertServiceFactory::CreateForProfile(profile);
431 #endif 430 #endif
432 // The URLBlacklistManager has to be created on the UI thread to register 431 // The URLBlacklistManager has to be created on the UI thread to register
433 // observers of |pref_service|, and it also has to clean up on 432 // observers of |pref_service|, and it also has to clean up on
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 // Allow either Init() or SetCookieSettingsForTesting() to initialize. 722 // Allow either Init() or SetCookieSettingsForTesting() to initialize.
724 DCHECK(initialized_ || cookie_settings_.get()); 723 DCHECK(initialized_ || cookie_settings_.get());
725 return cookie_settings_.get(); 724 return cookie_settings_.get();
726 } 725 }
727 726
728 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const { 727 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const {
729 DCHECK(initialized_); 728 DCHECK(initialized_);
730 return host_content_settings_map_.get(); 729 return host_content_settings_map_.get();
731 } 730 }
732 731
733 std::string ProfileIOData::GetMediaDeviceIDSalt() const { 732 ResourceContext::SaltCallback ProfileIOData::GetMediaDeviceIDSalt() const {
734 return media_device_id_salt_->GetSalt(); 733 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_);
735 } 734 }
736 735
737 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { 736 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() {
738 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 737 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
739 #if defined(OS_CHROMEOS) 738 #if defined(OS_CHROMEOS)
740 // Just fetch the value from ChromeOS' settings while we're on the UI thread. 739 // Just fetch the value from ChromeOS' settings while we're on the UI thread.
741 // TODO(stevet): For now, this value is only set on profile initialization. 740 // TODO(stevet): For now, this value is only set on profile initialization.
742 // We will want to do something similar to the PrefMember method below in the 741 // We will want to do something similar to the PrefMember method below in the
743 // future to more accurately capture this state. 742 // future to more accurately capture this state.
744 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, 743 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 868
870 bool ProfileIOData::ResourceContext::AllowContentAccess( 869 bool ProfileIOData::ResourceContext::AllowContentAccess(
871 const GURL& origin, ContentSettingsType type) { 870 const GURL& origin, ContentSettingsType type) {
872 HostContentSettingsMap* content_settings = 871 HostContentSettingsMap* content_settings =
873 io_data_->GetHostContentSettingsMap(); 872 io_data_->GetHostContentSettingsMap();
874 ContentSetting setting = content_settings->GetContentSetting( 873 ContentSetting setting = content_settings->GetContentSetting(
875 origin, origin, type, NO_RESOURCE_IDENTIFIER); 874 origin, origin, type, NO_RESOURCE_IDENTIFIER);
876 return setting == CONTENT_SETTING_ALLOW; 875 return setting == CONTENT_SETTING_ALLOW;
877 } 876 }
878 877
879 std::string ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() { 878 ResourceContext::SaltCallback
879 ProfileIOData::ResourceContext::GetMediaDeviceIDSalt() {
880 return io_data_->GetMediaDeviceIDSalt(); 880 return io_data_->GetMediaDeviceIDSalt();
881 } 881 }
882 882
883 // static 883 // static
884 std::string ProfileIOData::GetSSLSessionCacheShard() { 884 std::string ProfileIOData::GetSSLSessionCacheShard() {
885 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 885 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
886 // The SSL session cache is partitioned by setting a string. This returns a 886 // The SSL session cache is partitioned by setting a string. This returns a
887 // unique string to partition the SSL session cache. Each time we create a 887 // unique string to partition the SSL session cache. Each time we create a
888 // new profile, we'll get a fresh SSL session cache which is separate from 888 // new profile, we'll get a fresh SSL session cache which is separate from
889 // the other profiles. 889 // the other profiles.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 void ProfileIOData::SetCookieSettingsForTesting( 1139 void ProfileIOData::SetCookieSettingsForTesting(
1140 CookieSettings* cookie_settings) { 1140 CookieSettings* cookie_settings) {
1141 DCHECK(!cookie_settings_.get()); 1141 DCHECK(!cookie_settings_.get());
1142 cookie_settings_ = cookie_settings; 1142 cookie_settings_ = cookie_settings;
1143 } 1143 }
1144 1144
1145 void ProfileIOData::set_signin_names_for_testing( 1145 void ProfileIOData::set_signin_names_for_testing(
1146 SigninNamesOnIOThread* signin_names) { 1146 SigninNamesOnIOThread* signin_names) {
1147 signin_names_.reset(signin_names); 1147 signin_names_.reset(signin_names);
1148 } 1148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698