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

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

Issue 7685009: Revert "Modifying prefetch to account for multi-profile." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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/profiles/profile_impl.h ('k') | chrome/browser/profiles/profile_impl_io_data.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 29 matching lines...) Expand all
40 #include "chrome/browser/favicon/favicon_service.h" 40 #include "chrome/browser/favicon/favicon_service.h"
41 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" 41 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
42 #include "chrome/browser/history/history.h" 42 #include "chrome/browser/history/history.h"
43 #include "chrome/browser/history/shortcuts_backend.h" 43 #include "chrome/browser/history/shortcuts_backend.h"
44 #include "chrome/browser/history/top_sites.h" 44 #include "chrome/browser/history/top_sites.h"
45 #include "chrome/browser/instant/instant_controller.h" 45 #include "chrome/browser/instant/instant_controller.h"
46 #include "chrome/browser/metrics/metrics_service.h" 46 #include "chrome/browser/metrics/metrics_service.h"
47 #include "chrome/browser/net/chrome_url_request_context.h" 47 #include "chrome/browser/net/chrome_url_request_context.h"
48 #include "chrome/browser/net/gaia/token_service.h" 48 #include "chrome/browser/net/gaia/token_service.h"
49 #include "chrome/browser/net/net_pref_observer.h" 49 #include "chrome/browser/net/net_pref_observer.h"
50 #include "chrome/browser/net/predictor.h"
51 #include "chrome/browser/net/pref_proxy_config_service.h" 50 #include "chrome/browser/net/pref_proxy_config_service.h"
52 #include "chrome/browser/net/ssl_config_service_manager.h" 51 #include "chrome/browser/net/ssl_config_service_manager.h"
53 #include "chrome/browser/password_manager/password_store_default.h" 52 #include "chrome/browser/password_manager/password_store_default.h"
54 #include "chrome/browser/policy/configuration_policy_pref_store.h" 53 #include "chrome/browser/policy/configuration_policy_pref_store.h"
55 #include "chrome/browser/prefs/browser_prefs.h" 54 #include "chrome/browser/prefs/browser_prefs.h"
56 #include "chrome/browser/prefs/pref_value_store.h" 55 #include "chrome/browser/prefs/pref_value_store.h"
57 #include "chrome/browser/prefs/scoped_user_pref_update.h" 56 #include "chrome/browser/prefs/scoped_user_pref_update.h"
58 #include "chrome/browser/prerender/prerender_manager.h" 57 #include "chrome/browser/prerender/prerender_manager.h"
59 #include "chrome/browser/profiles/profile_dependency_manager.h" 58 #include "chrome/browser/profiles/profile_dependency_manager.h"
60 #include "chrome/browser/profiles/profile_manager.h" 59 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 host_zoom_map_(NULL), 299 host_zoom_map_(NULL),
301 history_service_created_(false), 300 history_service_created_(false),
302 favicon_service_created_(false), 301 favicon_service_created_(false),
303 created_web_data_service_(false), 302 created_web_data_service_(false),
304 created_password_store_(false), 303 created_password_store_(false),
305 created_download_manager_(false), 304 created_download_manager_(false),
306 start_time_(Time::Now()), 305 start_time_(Time::Now()),
307 #if defined(OS_WIN) 306 #if defined(OS_WIN)
308 checked_instant_promo_(false), 307 checked_instant_promo_(false),
309 #endif 308 #endif
310 delegate_(delegate), 309 delegate_(delegate) {
311 predictor_(NULL) {
312 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << 310 DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
313 "profile files to the root directory!"; 311 "profile files to the root directory!";
314 312
315 create_session_service_timer_.Start( 313 create_session_service_timer_.Start(
316 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, 314 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
317 &ProfileImpl::EnsureSessionServiceCreated); 315 &ProfileImpl::EnsureSessionServiceCreated);
318 316
319 // Determine if prefetch is enabled for this profile.
320 // If not profile_manager is present, it means we are in a unittest.
321 const CommandLine* command_line = CommandLine::ForCurrentProcess();
322 predictor_ = chrome_browser_net::Predictor::CreatePredictor(
323 !command_line->HasSwitch(switches::kDisablePreconnect),
324 g_browser_process->profile_manager() == NULL);
325
326 if (delegate_) { 317 if (delegate_) {
327 prefs_.reset(PrefService::CreatePrefService( 318 prefs_.reset(PrefService::CreatePrefService(
328 GetPrefFilePath(), 319 GetPrefFilePath(),
329 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), 320 new ExtensionPrefStore(GetExtensionPrefValueMap(), false),
330 true)); 321 true));
331 // Wait for the notifcation that prefs has been loaded (successfully or 322 // Wait for the notifcation that prefs has been loaded (successfully or
332 // not). 323 // not).
333 registrar_.Add(this, chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, 324 registrar_.Add(this, chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED,
334 Source<PrefService>(prefs_.get())); 325 Source<PrefService>(prefs_.get()));
335 } else { 326 } else {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 media_cache_path = GetMediaCachePath(media_cache_path); 427 media_cache_path = GetMediaCachePath(media_cache_path);
437 428
438 FilePath extensions_cookie_path = GetPath(); 429 FilePath extensions_cookie_path = GetPath();
439 extensions_cookie_path = 430 extensions_cookie_path =
440 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); 431 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename);
441 432
442 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); 433 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname);
443 434
444 // Make sure we initialize the ProfileIOData after everything else has been 435 // Make sure we initialize the ProfileIOData after everything else has been
445 // initialized that we might be reading from the IO thread. 436 // initialized that we might be reading from the IO thread.
446
447 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path, 437 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path,
448 cache_max_size, media_cache_path, media_cache_max_size, 438 cache_max_size, media_cache_path, media_cache_max_size,
449 extensions_cookie_path, app_path, predictor_, 439 extensions_cookie_path, app_path);
450 g_browser_process->local_state(),
451 g_browser_process->io_thread());
452 440
453 // Creation has been finished. 441 // Creation has been finished.
454 if (delegate_) 442 if (delegate_)
455 delegate_->OnProfileCreated(this, true); 443 delegate_->OnProfileCreated(this, true);
456 444
457 NotificationService::current()->Notify( 445 NotificationService::current()->Notify(
458 chrome::NOTIFICATION_PROFILE_CREATED, 446 chrome::NOTIFICATION_PROFILE_CREATED,
459 Source<Profile>(this), 447 Source<Profile>(this),
460 NotificationService::NoDetails()); 448 NotificationService::NoDetails());
461 } 449 }
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 888 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
901 GetExtensionPrefValueMap())); 889 GetExtensionPrefValueMap()));
902 890
903 extension_settings_ = new ExtensionSettings( 891 extension_settings_ = new ExtensionSettings(
904 GetPath().AppendASCII(ExtensionService::kSettingsDirectoryName)); 892 GetPath().AppendASCII(ExtensionService::kSettingsDirectoryName));
905 893
906 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); 894 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false);
907 895
908 DCHECK(!net_pref_observer_.get()); 896 DCHECK(!net_pref_observer_.get());
909 net_pref_observer_.reset( 897 net_pref_observer_.reset(
910 new NetPrefObserver(prefs_.get(), GetPrerenderManager(), predictor_)); 898 new NetPrefObserver(prefs_.get(), GetPrerenderManager()));
911 899
912 DoFinalInit(); 900 DoFinalInit();
913 } 901 }
914 902
915 PrefService* ProfileImpl::GetPrefs() { 903 PrefService* ProfileImpl::GetPrefs() {
916 DCHECK(prefs_.get()); // Should explicitly be initialized. 904 DCHECK(prefs_.get()); // Should explicitly be initialized.
917 return prefs_.get(); 905 return prefs_.get();
918 } 906 }
919 907
920 PrefService* ProfileImpl::GetOffTheRecordPrefs() { 908 PrefService* ProfileImpl::GetOffTheRecordPrefs() {
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 this, g_browser_process->prerender_tracker())); 1711 this, g_browser_process->prerender_tracker()));
1724 #if defined(OS_CHROMEOS) 1712 #if defined(OS_CHROMEOS)
1725 prerender_manager_->AddCondition( 1713 prerender_manager_->AddCondition(
1726 new chromeos::PrerenderConditionNetwork( 1714 new chromeos::PrerenderConditionNetwork(
1727 chromeos::CrosLibrary::Get()->GetNetworkLibrary())); 1715 chromeos::CrosLibrary::Get()->GetNetworkLibrary()));
1728 #endif 1716 #endif
1729 } 1717 }
1730 return prerender_manager_.get(); 1718 return prerender_manager_.get();
1731 } 1719 }
1732 1720
1733 chrome_browser_net::Predictor* ProfileImpl::GetNetworkPredictor() {
1734 return predictor_;
1735 }
1736
1737 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { 1721 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() {
1738 if (!spellcheck_profile_.get()) 1722 if (!spellcheck_profile_.get())
1739 spellcheck_profile_.reset(new SpellCheckProfile()); 1723 spellcheck_profile_.reset(new SpellCheckProfile());
1740 return spellcheck_profile_.get(); 1724 return spellcheck_profile_.get();
1741 } 1725 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/profiles/profile_impl_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698