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

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

Issue 7467012: Modifying prefetch to account for multi-profile. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 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 26 matching lines...) Expand all
37 #include "chrome/browser/extensions/user_script_master.h" 37 #include "chrome/browser/extensions/user_script_master.h"
38 #include "chrome/browser/favicon/favicon_service.h" 38 #include "chrome/browser/favicon/favicon_service.h"
39 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 39 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
40 #include "chrome/browser/history/history.h" 40 #include "chrome/browser/history/history.h"
41 #include "chrome/browser/history/top_sites.h" 41 #include "chrome/browser/history/top_sites.h"
42 #include "chrome/browser/instant/instant_controller.h" 42 #include "chrome/browser/instant/instant_controller.h"
43 #include "chrome/browser/metrics/metrics_service.h" 43 #include "chrome/browser/metrics/metrics_service.h"
44 #include "chrome/browser/net/chrome_url_request_context.h" 44 #include "chrome/browser/net/chrome_url_request_context.h"
45 #include "chrome/browser/net/gaia/token_service.h" 45 #include "chrome/browser/net/gaia/token_service.h"
46 #include "chrome/browser/net/net_pref_observer.h" 46 #include "chrome/browser/net/net_pref_observer.h"
47 #include "chrome/browser/net/predictor.h"
47 #include "chrome/browser/net/pref_proxy_config_service.h" 48 #include "chrome/browser/net/pref_proxy_config_service.h"
48 #include "chrome/browser/net/ssl_config_service_manager.h" 49 #include "chrome/browser/net/ssl_config_service_manager.h"
49 #include "chrome/browser/password_manager/password_store_default.h" 50 #include "chrome/browser/password_manager/password_store_default.h"
50 #include "chrome/browser/policy/configuration_policy_pref_store.h" 51 #include "chrome/browser/policy/configuration_policy_pref_store.h"
51 #include "chrome/browser/policy/configuration_policy_provider.h" 52 #include "chrome/browser/policy/configuration_policy_provider.h"
52 #include "chrome/browser/policy/profile_policy_connector.h" 53 #include "chrome/browser/policy/profile_policy_connector.h"
53 #include "chrome/browser/policy/profile_policy_connector_factory.h" 54 #include "chrome/browser/policy/profile_policy_connector_factory.h"
54 #include "chrome/browser/prefs/browser_prefs.h" 55 #include "chrome/browser/prefs/browser_prefs.h"
55 #include "chrome/browser/prefs/pref_value_store.h" 56 #include "chrome/browser/prefs/pref_value_store.h"
56 #include "chrome/browser/prefs/scoped_user_pref_update.h" 57 #include "chrome/browser/prefs/scoped_user_pref_update.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 588
588 FilePath ProfileImpl::last_selected_directory() { 589 FilePath ProfileImpl::last_selected_directory() {
589 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); 590 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
590 } 591 }
591 592
592 void ProfileImpl::set_last_selected_directory(const FilePath& path) { 593 void ProfileImpl::set_last_selected_directory(const FilePath& path) {
593 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); 594 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path);
594 } 595 }
595 596
596 ProfileImpl::~ProfileImpl() { 597 ProfileImpl::~ProfileImpl() {
598 if (GetPredictor())
599 GetPredictor()->SaveStateForNextStartupAndTrim(GetPrefs(), this);
600
597 NotificationService::current()->Notify( 601 NotificationService::current()->Notify(
598 NotificationType::PROFILE_DESTROYED, 602 NotificationType::PROFILE_DESTROYED,
599 Source<Profile>(this), 603 Source<Profile>(this),
600 NotificationService::NoDetails()); 604 NotificationService::NoDetails());
601 605
602 StopCreateSessionServiceTimer(); 606 StopCreateSessionServiceTimer();
603 607
604 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); 608 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
605 609
606 // DownloadManager is lazily created, so check before accessing it. 610 // DownloadManager is lazily created, so check before accessing it.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 822
819 // Ensure that preferences set by extensions are restored in the profile 823 // Ensure that preferences set by extensions are restored in the profile
820 // as early as possible. The constructor takes care of that. 824 // as early as possible. The constructor takes care of that.
821 extension_prefs_.reset(new ExtensionPrefs( 825 extension_prefs_.reset(new ExtensionPrefs(
822 prefs_.get(), 826 prefs_.get(),
823 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 827 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
824 GetExtensionPrefValueMap())); 828 GetExtensionPrefValueMap()));
825 829
826 DCHECK(!net_pref_observer_.get()); 830 DCHECK(!net_pref_observer_.get());
827 net_pref_observer_.reset( 831 net_pref_observer_.reset(
828 new NetPrefObserver(prefs_.get(), GetPrerenderManager())); 832 new NetPrefObserver(prefs_.get(), GetPrerenderManager(), GetPredictor()));
829 833
830 DoFinalInit(); 834 DoFinalInit();
831 } 835 }
832 836
833 PrefService* ProfileImpl::GetPrefs() { 837 PrefService* ProfileImpl::GetPrefs() {
834 DCHECK(prefs_.get()); // Should explicitly be initialized. 838 DCHECK(prefs_.get()); // Should explicitly be initialized.
835 return prefs_.get(); 839 return prefs_.get();
836 } 840 }
837 841
838 PrefService* ProfileImpl::GetOffTheRecordPrefs() { 842 PrefService* ProfileImpl::GetOffTheRecordPrefs() {
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 if (!prerender::PrerenderManager::IsPrerenderingPossible()) 1641 if (!prerender::PrerenderManager::IsPrerenderingPossible())
1638 return NULL; 1642 return NULL;
1639 if (!prerender_manager_.get()) { 1643 if (!prerender_manager_.get()) {
1640 CHECK(g_browser_process->prerender_tracker()); 1644 CHECK(g_browser_process->prerender_tracker());
1641 prerender_manager_.reset( 1645 prerender_manager_.reset(
1642 new prerender::PrerenderManager( 1646 new prerender::PrerenderManager(
1643 this, g_browser_process->prerender_tracker())); 1647 this, g_browser_process->prerender_tracker()));
1644 } 1648 }
1645 return prerender_manager_.get(); 1649 return prerender_manager_.get();
1646 } 1650 }
1651
1652 chrome_browser_net::Predictor* ProfileImpl::GetPredictor() {
1653 return io_data_.GetPredictor();
1654 }
1655
1656 void ProfileImpl::SetPredictor(chrome_browser_net::Predictor* predictor) {
1657 io_data_.SetPredictor(predictor);
1658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698