| 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 "chrome/browser/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #include "chrome/browser/web_resource/promo_resource_service.h" | 85 #include "chrome/browser/web_resource/promo_resource_service.h" |
| 86 #include "chrome/browser/webdata/web_data_service.h" | 86 #include "chrome/browser/webdata/web_data_service.h" |
| 87 #include "chrome/common/chrome_constants.h" | 87 #include "chrome/common/chrome_constants.h" |
| 88 #include "chrome/common/chrome_notification_types.h" | 88 #include "chrome/common/chrome_notification_types.h" |
| 89 #include "chrome/common/chrome_paths_internal.h" | 89 #include "chrome/common/chrome_paths_internal.h" |
| 90 #include "chrome/common/chrome_switches.h" | 90 #include "chrome/common/chrome_switches.h" |
| 91 #include "chrome/common/extensions/extension_permission_set.h" | 91 #include "chrome/common/extensions/extension_permission_set.h" |
| 92 #include "chrome/common/json_pref_store.h" | 92 #include "chrome/common/json_pref_store.h" |
| 93 #include "chrome/common/pref_names.h" | 93 #include "chrome/common/pref_names.h" |
| 94 #include "chrome/common/url_constants.h" | 94 #include "chrome/common/url_constants.h" |
| 95 #include "content/browser/appcache/chrome_appcache_service.h" | |
| 96 #include "content/browser/chrome_blob_storage_context.h" | |
| 97 #include "content/browser/file_system/browser_file_system_helper.h" | |
| 98 #include "content/browser/in_process_webkit/webkit_context.h" | 95 #include "content/browser/in_process_webkit/webkit_context.h" |
| 99 #include "content/browser/speech/speech_input_manager.h" | 96 #include "content/browser/speech/speech_input_manager.h" |
| 100 #include "content/public/browser/browser_thread.h" | 97 #include "content/public/browser/browser_thread.h" |
| 101 #include "content/public/browser/host_zoom_map.h" | 98 #include "content/public/browser/host_zoom_map.h" |
| 102 #include "content/public/browser/notification_service.h" | 99 #include "content/public/browser/notification_service.h" |
| 103 #include "content/public/browser/user_metrics.h" | 100 #include "content/public/browser/user_metrics.h" |
| 104 #include "grit/locale_settings.h" | 101 #include "grit/locale_settings.h" |
| 105 #include "net/base/transport_security_state.h" | 102 #include "net/base/transport_security_state.h" |
| 106 #include "net/http/http_server_properties.h" | 103 #include "net/http/http_server_properties.h" |
| 107 #include "webkit/database/database_tracker.h" | 104 #include "webkit/database/database_tracker.h" |
| 108 #include "webkit/quota/quota_manager.h" | |
| 109 | 105 |
| 110 #if defined(OS_WIN) | 106 #if defined(OS_WIN) |
| 111 #include "chrome/browser/instant/promo_counter.h" | 107 #include "chrome/browser/instant/promo_counter.h" |
| 112 #include "chrome/browser/password_manager/password_store_win.h" | 108 #include "chrome/browser/password_manager/password_store_win.h" |
| 113 #include "chrome/installer/util/install_util.h" | 109 #include "chrome/installer/util/install_util.h" |
| 114 #elif defined(OS_MACOSX) | 110 #elif defined(OS_MACOSX) |
| 115 #include "chrome/browser/keychain_mac.h" | 111 #include "chrome/browser/keychain_mac.h" |
| 116 #include "chrome/browser/mock_keychain_mac.h" | 112 #include "chrome/browser/mock_keychain_mac.h" |
| 117 #include "chrome/browser/password_manager/password_store_mac.h" | 113 #include "chrome/browser/password_manager/password_store_mac.h" |
| 118 #elif defined(OS_CHROMEOS) | 114 #elif defined(OS_CHROMEOS) |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } | 538 } |
| 543 | 539 |
| 544 ProfileImpl::~ProfileImpl() { | 540 ProfileImpl::~ProfileImpl() { |
| 545 content::NotificationService::current()->Notify( | 541 content::NotificationService::current()->Notify( |
| 546 chrome::NOTIFICATION_PROFILE_DESTROYED, | 542 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 547 content::Source<Profile>(this), | 543 content::Source<Profile>(this), |
| 548 content::NotificationService::NoDetails()); | 544 content::NotificationService::NoDetails()); |
| 549 // Save the session state if we're going to restore the session during the | 545 // Save the session state if we're going to restore the session during the |
| 550 // next startup. | 546 // next startup. |
| 551 SessionStartupPref pref = SessionStartupPref::GetStartupPref(this); | 547 SessionStartupPref pref = SessionStartupPref::GetStartupPref(this); |
| 552 if (pref.type == SessionStartupPref::LAST) | 548 if (pref.type == SessionStartupPref::LAST) { |
| 553 SaveSessionState(); | 549 SaveSessionState(); |
| 554 else if (appcache_service_ && clear_local_state_on_exit_) { | 550 } else if (clear_local_state_on_exit_) { |
| 555 BrowserThread::PostTask( | 551 BrowserThread::PostTask( |
| 556 BrowserThread::IO, FROM_HERE, | 552 BrowserThread::IO, FROM_HERE, |
| 557 base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit, | 553 base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit, |
| 558 appcache_service_.get(), true)); | 554 BrowserContext::GetAppCacheService(this), true)); |
| 555 BrowserContext::GetWebKitContext(this)->set_clear_local_state_on_exit(true); |
| 556 BrowserContext::GetDatabaseTracker(this)->SetClearLocalStateOnExit(true); |
| 559 } | 557 } |
| 560 | 558 |
| 561 StopCreateSessionServiceTimer(); | 559 StopCreateSessionServiceTimer(); |
| 562 | 560 |
| 563 // Remove pref observers | 561 // Remove pref observers |
| 564 pref_change_registrar_.RemoveAll(); | 562 pref_change_registrar_.RemoveAll(); |
| 565 | 563 |
| 566 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 564 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
| 567 io_data_.GetResourceContextNoInit()); | 565 io_data_.GetResourceContextNoInit()); |
| 568 | 566 |
| 569 if (io_data_.HasMainRequestContext() && | 567 if (io_data_.HasMainRequestContext() && |
| 570 default_request_context_ == GetRequestContext()) { | 568 default_request_context_ == GetRequestContext()) { |
| 571 default_request_context_ = NULL; | 569 default_request_context_ = NULL; |
| 572 } | 570 } |
| 573 | 571 |
| 574 // Destroy OTR profile and its profile services first. | 572 // Destroy OTR profile and its profile services first. |
| 575 DestroyOffTheRecordProfile(); | 573 DestroyOffTheRecordProfile(); |
| 576 | 574 |
| 577 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 575 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 578 | 576 |
| 579 if (db_tracker_) { | |
| 580 BrowserThread::PostTask( | |
| 581 BrowserThread::FILE, FROM_HERE, | |
| 582 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | |
| 583 db_tracker_.get())); | |
| 584 } | |
| 585 | |
| 586 // Password store uses WebDB, shut it down before the WebDB has been shutdown. | 577 // Password store uses WebDB, shut it down before the WebDB has been shutdown. |
| 587 if (password_store_.get()) | 578 if (password_store_.get()) |
| 588 password_store_->Shutdown(); | 579 password_store_->Shutdown(); |
| 589 | 580 |
| 590 // Both HistoryService and WebDataService maintain threads for background | 581 // Both HistoryService and WebDataService maintain threads for background |
| 591 // processing. Its possible each thread still has tasks on it that have | 582 // processing. Its possible each thread still has tasks on it that have |
| 592 // increased the ref count of the service. In such a situation, when we | 583 // increased the ref count of the service. In such a situation, when we |
| 593 // decrement the refcount, it won't be 0, and the threads/databases aren't | 584 // decrement the refcount, it won't be 0, and the threads/databases aren't |
| 594 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the | 585 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the |
| 595 // databases are properly closed. | 586 // databases are properly closed. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 } | 664 } |
| 674 | 665 |
| 675 bool ProfileImpl::HasOffTheRecordProfile() { | 666 bool ProfileImpl::HasOffTheRecordProfile() { |
| 676 return off_the_record_profile_.get() != NULL; | 667 return off_the_record_profile_.get() != NULL; |
| 677 } | 668 } |
| 678 | 669 |
| 679 Profile* ProfileImpl::GetOriginalProfile() { | 670 Profile* ProfileImpl::GetOriginalProfile() { |
| 680 return this; | 671 return this; |
| 681 } | 672 } |
| 682 | 673 |
| 683 ChromeAppCacheService* ProfileImpl::GetAppCacheService() { | |
| 684 CreateQuotaManagerAndClients(); | |
| 685 return appcache_service_; | |
| 686 } | |
| 687 | |
| 688 webkit_database::DatabaseTracker* ProfileImpl::GetDatabaseTracker() { | |
| 689 CreateQuotaManagerAndClients(); | |
| 690 return db_tracker_; | |
| 691 } | |
| 692 | |
| 693 VisitedLinkMaster* ProfileImpl::GetVisitedLinkMaster() { | 674 VisitedLinkMaster* ProfileImpl::GetVisitedLinkMaster() { |
| 694 if (!visited_link_master_.get()) { | 675 if (!visited_link_master_.get()) { |
| 695 scoped_ptr<VisitedLinkMaster> visited_links( | 676 scoped_ptr<VisitedLinkMaster> visited_links( |
| 696 new VisitedLinkMaster(visited_link_event_listener_.get(), this)); | 677 new VisitedLinkMaster(visited_link_event_listener_.get(), this)); |
| 697 if (!visited_links->Init()) | 678 if (!visited_links->Init()) |
| 698 return NULL; | 679 return NULL; |
| 699 visited_link_master_.swap(visited_links); | 680 visited_link_master_.swap(visited_links); |
| 700 } | 681 } |
| 701 | 682 |
| 702 return visited_link_master_.get(); | 683 return visited_link_master_.get(); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 NOTREACHED() << "Could not initialize password manager."; | 1110 NOTREACHED() << "Could not initialize password manager."; |
| 1130 return; | 1111 return; |
| 1131 } | 1112 } |
| 1132 password_store_.swap(ps); | 1113 password_store_.swap(ps); |
| 1133 } | 1114 } |
| 1134 | 1115 |
| 1135 DownloadManager* ProfileImpl::GetDownloadManager() { | 1116 DownloadManager* ProfileImpl::GetDownloadManager() { |
| 1136 return DownloadServiceFactory::GetForProfile(this)->GetDownloadManager(); | 1117 return DownloadServiceFactory::GetForProfile(this)->GetDownloadManager(); |
| 1137 } | 1118 } |
| 1138 | 1119 |
| 1139 fileapi::FileSystemContext* ProfileImpl::GetFileSystemContext() { | |
| 1140 CreateQuotaManagerAndClients(); | |
| 1141 return file_system_context_.get(); | |
| 1142 } | |
| 1143 | |
| 1144 quota::QuotaManager* ProfileImpl::GetQuotaManager() { | |
| 1145 CreateQuotaManagerAndClients(); | |
| 1146 return quota_manager_.get(); | |
| 1147 } | |
| 1148 | |
| 1149 bool ProfileImpl::DidLastSessionExitCleanly() { | 1120 bool ProfileImpl::DidLastSessionExitCleanly() { |
| 1150 // last_session_exited_cleanly_ is set when the preferences are loaded. Force | 1121 // last_session_exited_cleanly_ is set when the preferences are loaded. Force |
| 1151 // it to be set by asking for the prefs. | 1122 // it to be set by asking for the prefs. |
| 1152 GetPrefs(); | 1123 GetPrefs(); |
| 1153 return last_session_exited_cleanly_; | 1124 return last_session_exited_cleanly_; |
| 1154 } | 1125 } |
| 1155 | 1126 |
| 1127 quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { |
| 1128 return GetExtensionSpecialStoragePolicy(); |
| 1129 } |
| 1130 |
| 1156 BookmarkModel* ProfileImpl::GetBookmarkModel() { | 1131 BookmarkModel* ProfileImpl::GetBookmarkModel() { |
| 1157 if (!bookmark_bar_model_.get()) { | 1132 if (!bookmark_bar_model_.get()) { |
| 1158 bookmark_bar_model_.reset(new BookmarkModel(this)); | 1133 bookmark_bar_model_.reset(new BookmarkModel(this)); |
| 1159 bookmark_bar_model_->Load(); | 1134 bookmark_bar_model_->Load(); |
| 1160 } | 1135 } |
| 1161 return bookmark_bar_model_.get(); | 1136 return bookmark_bar_model_.get(); |
| 1162 } | 1137 } |
| 1163 | 1138 |
| 1164 ProtocolHandlerRegistry* ProfileImpl::GetProtocolHandlerRegistry() { | 1139 ProtocolHandlerRegistry* ProfileImpl::GetProtocolHandlerRegistry() { |
| 1165 return protocol_handler_registry_.get(); | 1140 return protocol_handler_registry_.get(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1187 history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() { | 1162 history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() { |
| 1188 return top_sites_; | 1163 return top_sites_; |
| 1189 } | 1164 } |
| 1190 | 1165 |
| 1191 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { | 1166 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { |
| 1192 if (!extension_pref_value_map_.get()) | 1167 if (!extension_pref_value_map_.get()) |
| 1193 extension_pref_value_map_.reset(new ExtensionPrefValueMap); | 1168 extension_pref_value_map_.reset(new ExtensionPrefValueMap); |
| 1194 return extension_pref_value_map_.get(); | 1169 return extension_pref_value_map_.get(); |
| 1195 } | 1170 } |
| 1196 | 1171 |
| 1197 void ProfileImpl::CreateQuotaManagerAndClients() { | |
| 1198 if (quota_manager_.get()) { | |
| 1199 DCHECK(file_system_context_.get()); | |
| 1200 DCHECK(db_tracker_.get()); | |
| 1201 DCHECK(webkit_context_.get()); | |
| 1202 return; | |
| 1203 } | |
| 1204 | |
| 1205 // All of the clients have to be created and registered with the | |
| 1206 // QuotaManager prior to the QuotaManger being used. So we do them | |
| 1207 // all together here prior to handing out a reference to anything | |
| 1208 // that utlizes the QuotaManager. | |
| 1209 quota_manager_ = new quota::QuotaManager( | |
| 1210 IsOffTheRecord(), | |
| 1211 GetPath(), | |
| 1212 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | |
| 1213 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | |
| 1214 GetExtensionSpecialStoragePolicy()); | |
| 1215 | |
| 1216 // Each consumer is responsible for registering its QuotaClient during | |
| 1217 // its construction. | |
| 1218 file_system_context_ = CreateFileSystemContext( | |
| 1219 GetPath(), IsOffTheRecord(), | |
| 1220 GetExtensionSpecialStoragePolicy(), | |
| 1221 quota_manager_->proxy()); | |
| 1222 db_tracker_ = new webkit_database::DatabaseTracker( | |
| 1223 GetPath(), IsOffTheRecord(), clear_local_state_on_exit_, | |
| 1224 GetExtensionSpecialStoragePolicy(), | |
| 1225 quota_manager_->proxy(), | |
| 1226 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | |
| 1227 webkit_context_ = new WebKitContext( | |
| 1228 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), | |
| 1229 clear_local_state_on_exit_, quota_manager_->proxy(), | |
| 1230 BrowserThread::GetMessageLoopProxyForThread( | |
| 1231 BrowserThread::WEBKIT_DEPRECATED)); | |
| 1232 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | |
| 1233 BrowserThread::PostTask( | |
| 1234 BrowserThread::IO, FROM_HERE, | |
| 1235 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | |
| 1236 appcache_service_.get(), | |
| 1237 IsOffTheRecord() | |
| 1238 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | |
| 1239 io_data_.GetResourceContextNoInit(), | |
| 1240 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); | |
| 1241 } | |
| 1242 | |
| 1243 WebKitContext* ProfileImpl::GetWebKitContext() { | |
| 1244 CreateQuotaManagerAndClients(); | |
| 1245 return webkit_context_.get(); | |
| 1246 } | |
| 1247 | |
| 1248 void ProfileImpl::MarkAsCleanShutdown() { | 1172 void ProfileImpl::MarkAsCleanShutdown() { |
| 1249 if (prefs_.get()) { | 1173 if (prefs_.get()) { |
| 1250 // The session cleanly exited, set kSessionExitedCleanly appropriately. | 1174 // The session cleanly exited, set kSessionExitedCleanly appropriately. |
| 1251 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); | 1175 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); |
| 1252 | 1176 |
| 1253 // NOTE: If you change what thread this writes on, be sure and update | 1177 // NOTE: If you change what thread this writes on, be sure and update |
| 1254 // ChromeFrame::EndSession(). | 1178 // ChromeFrame::EndSession(). |
| 1255 prefs_->CommitPendingWrite(); | 1179 prefs_->CommitPendingWrite(); |
| 1256 } | 1180 } |
| 1257 } | 1181 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1273 case chrome::NOTIFICATION_PREF_CHANGED: { | 1197 case chrome::NOTIFICATION_PREF_CHANGED: { |
| 1274 std::string* pref_name_in = content::Details<std::string>(details).ptr(); | 1198 std::string* pref_name_in = content::Details<std::string>(details).ptr(); |
| 1275 PrefService* prefs = content::Source<PrefService>(source).ptr(); | 1199 PrefService* prefs = content::Source<PrefService>(source).ptr(); |
| 1276 DCHECK(pref_name_in && prefs); | 1200 DCHECK(pref_name_in && prefs); |
| 1277 if (*pref_name_in == prefs::kSpeechInputFilterProfanities) { | 1201 if (*pref_name_in == prefs::kSpeechInputFilterProfanities) { |
| 1278 GetSpeechInputPreferences()->SetFilterProfanities(prefs->GetBoolean( | 1202 GetSpeechInputPreferences()->SetFilterProfanities(prefs->GetBoolean( |
| 1279 prefs::kSpeechInputFilterProfanities)); | 1203 prefs::kSpeechInputFilterProfanities)); |
| 1280 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1204 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
| 1281 clear_local_state_on_exit_ = | 1205 clear_local_state_on_exit_ = |
| 1282 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1206 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| 1283 if (webkit_context_) { | |
| 1284 webkit_context_->set_clear_local_state_on_exit( | |
| 1285 clear_local_state_on_exit_); | |
| 1286 } | |
| 1287 if (db_tracker_) { | |
| 1288 db_tracker_->SetClearLocalStateOnExit( | |
| 1289 clear_local_state_on_exit_); | |
| 1290 } | |
| 1291 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { | 1207 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { |
| 1292 UpdateProfileUserNameCache(); | 1208 UpdateProfileUserNameCache(); |
| 1293 } else if (*pref_name_in == prefs::kProfileAvatarIndex) { | 1209 } else if (*pref_name_in == prefs::kProfileAvatarIndex) { |
| 1294 UpdateProfileAvatarCache(); | 1210 UpdateProfileAvatarCache(); |
| 1295 } else if (*pref_name_in == prefs::kProfileName) { | 1211 } else if (*pref_name_in == prefs::kProfileName) { |
| 1296 UpdateProfileNameCache(); | 1212 UpdateProfileNameCache(); |
| 1297 } else if (*pref_name_in == prefs::kDefaultZoomLevel) { | 1213 } else if (*pref_name_in == prefs::kDefaultZoomLevel) { |
| 1298 GetHostZoomMap()->SetDefaultZoomLevel( | 1214 GetHostZoomMap()->SetDefaultZoomLevel( |
| 1299 prefs->GetDouble(prefs::kDefaultZoomLevel)); | 1215 prefs->GetDouble(prefs::kDefaultZoomLevel)); |
| 1300 } | 1216 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 SessionServiceFactory::GetForProfile(this); | 1251 SessionServiceFactory::GetForProfile(this); |
| 1336 } | 1252 } |
| 1337 | 1253 |
| 1338 TokenService* ProfileImpl::GetTokenService() { | 1254 TokenService* ProfileImpl::GetTokenService() { |
| 1339 if (!token_service_.get()) { | 1255 if (!token_service_.get()) { |
| 1340 token_service_.reset(new TokenService()); | 1256 token_service_.reset(new TokenService()); |
| 1341 } | 1257 } |
| 1342 return token_service_.get(); | 1258 return token_service_.get(); |
| 1343 } | 1259 } |
| 1344 | 1260 |
| 1345 ChromeBlobStorageContext* ProfileImpl::GetBlobStorageContext() { | |
| 1346 if (!blob_storage_context_) { | |
| 1347 blob_storage_context_ = new ChromeBlobStorageContext(); | |
| 1348 BrowserThread::PostTask( | |
| 1349 BrowserThread::IO, FROM_HERE, | |
| 1350 base::Bind(&ChromeBlobStorageContext::InitializeOnIOThread, | |
| 1351 blob_storage_context_.get())); | |
| 1352 } | |
| 1353 return blob_storage_context_; | |
| 1354 } | |
| 1355 | |
| 1356 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { | 1261 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { |
| 1357 return extension_info_map_.get(); | 1262 return extension_info_map_.get(); |
| 1358 } | 1263 } |
| 1359 | 1264 |
| 1360 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { | 1265 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { |
| 1361 if (!chrome_url_data_manager_.get()) | 1266 if (!chrome_url_data_manager_.get()) |
| 1362 chrome_url_data_manager_.reset(new ChromeURLDataManager( | 1267 chrome_url_data_manager_.reset(new ChromeURLDataManager( |
| 1363 io_data_.GetChromeURLDataManagerBackendGetter())); | 1268 io_data_.GetChromeURLDataManagerBackendGetter())); |
| 1364 return chrome_url_data_manager_.get(); | 1269 return chrome_url_data_manager_.get(); |
| 1365 } | 1270 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 GetPrefs()->GetString(prefs::kHomePage), | 1424 GetPrefs()->GetString(prefs::kHomePage), |
| 1520 std::string())); | 1425 std::string())); |
| 1521 if (!home_page.is_valid()) | 1426 if (!home_page.is_valid()) |
| 1522 return GURL(chrome::kChromeUINewTabURL); | 1427 return GURL(chrome::kChromeUINewTabURL); |
| 1523 return home_page; | 1428 return home_page; |
| 1524 } | 1429 } |
| 1525 | 1430 |
| 1526 void ProfileImpl::SaveSessionState() { | 1431 void ProfileImpl::SaveSessionState() { |
| 1527 if (!session_restore_enabled_) | 1432 if (!session_restore_enabled_) |
| 1528 return; | 1433 return; |
| 1529 if (webkit_context_.get()) | 1434 BrowserContext::GetWebKitContext(this)->SaveSessionState(); |
| 1530 webkit_context_->SaveSessionState(); | 1435 BrowserContext::GetDatabaseTracker(this)->SaveSessionState(); |
| 1531 if (db_tracker_.get()) | |
| 1532 db_tracker_->SaveSessionState(); | |
| 1533 | 1436 |
| 1534 BrowserThread::PostTask( | 1437 BrowserThread::PostTask( |
| 1535 BrowserThread::IO, FROM_HERE, | 1438 BrowserThread::IO, FROM_HERE, |
| 1536 base::Bind(&SaveSessionStateOnIOThread, | 1439 base::Bind(&SaveSessionStateOnIOThread, |
| 1537 make_scoped_refptr(GetRequestContext()), | 1440 make_scoped_refptr(GetRequestContext()), |
| 1538 make_scoped_refptr(appcache_service_.get()))); | 1441 make_scoped_refptr(BrowserContext::GetAppCacheService(this)))); |
| 1539 } | 1442 } |
| 1540 | 1443 |
| 1541 void ProfileImpl::UpdateProfileUserNameCache() { | 1444 void ProfileImpl::UpdateProfileUserNameCache() { |
| 1542 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1445 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 1543 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1446 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
| 1544 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1447 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
| 1545 if (index != std::string::npos) { | 1448 if (index != std::string::npos) { |
| 1546 std::string user_name = | 1449 std::string user_name = |
| 1547 GetPrefs()->GetString(prefs::kGoogleServicesUsername); | 1450 GetPrefs()->GetString(prefs::kGoogleServicesUsername); |
| 1548 cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name)); | 1451 cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 FilePath* cache_path, | 1483 FilePath* cache_path, |
| 1581 int* max_size) { | 1484 int* max_size) { |
| 1582 DCHECK(cache_path); | 1485 DCHECK(cache_path); |
| 1583 DCHECK(max_size); | 1486 DCHECK(max_size); |
| 1584 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1487 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
| 1585 if (!path.empty()) | 1488 if (!path.empty()) |
| 1586 *cache_path = path; | 1489 *cache_path = path; |
| 1587 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1490 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1588 prefs_->GetInteger(prefs::kDiskCacheSize); | 1491 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1589 } | 1492 } |
| OLD | NEW |