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

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

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed whitespaces in mac files Created 9 years, 11 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/environment.h" 8 #include "base/environment.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 new TransportSecurityPersister(); 676 new TransportSecurityPersister();
677 transport_security_persister_->Initialize( 677 transport_security_persister_->Initialize(
678 transport_security_state_.get(), path_); 678 transport_security_state_.get(), path_);
679 } 679 }
680 680
681 return transport_security_state_.get(); 681 return transport_security_state_.get();
682 } 682 }
683 683
684 PrefService* ProfileImpl::GetPrefs() { 684 PrefService* ProfileImpl::GetPrefs() {
685 if (!prefs_.get()) { 685 if (!prefs_.get()) {
686 ExtensionPrefStore* extension_pref_store = new ExtensionPrefStore; 686 prefs_.reset(PrefService::CreatePrefService(
687 prefs_.reset(PrefService::CreatePrefService(GetPrefFilePath(), 687 GetPrefFilePath(),
688 extension_pref_store, 688 new ExtensionPrefStore(GetExtensionPrefValueMap(), false),
689 GetOriginalProfile())); 689 GetOriginalProfile()));
690 690
691 // The Profile class and ProfileManager class may read some prefs so 691 // The Profile class and ProfileManager class may read some prefs so
692 // register known prefs as soon as possible. 692 // register known prefs as soon as possible.
693 Profile::RegisterUserPrefs(prefs_.get()); 693 Profile::RegisterUserPrefs(prefs_.get());
694 browser::RegisterUserPrefs(prefs_.get()); 694 browser::RegisterUserPrefs(prefs_.get());
695 695
696 // The last session exited cleanly if there is no pref for 696 // The last session exited cleanly if there is no pref for
697 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. 697 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true.
698 last_session_exited_cleanly_ = 698 last_session_exited_cleanly_ =
699 prefs_->GetBoolean(prefs::kSessionExitedCleanly); 699 prefs_->GetBoolean(prefs::kSessionExitedCleanly);
700 // Mark the session as open. 700 // Mark the session as open.
701 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); 701 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false);
702 // Make sure we save to disk that the session has opened. 702 // Make sure we save to disk that the session has opened.
703 prefs_->ScheduleSavePersistentPrefs(); 703 prefs_->ScheduleSavePersistentPrefs();
704 704
705 // Ensure that preferences set by extensions are restored in the profile 705 // Ensure that preferences set by extensions are restored in the profile
706 // as early as possible. The constructor takes care of that. 706 // as early as possible. The constructor takes care of that.
707 extension_prefs_.reset(new ExtensionPrefs( 707 extension_prefs_.reset(new ExtensionPrefs(
708 prefs_.get(), 708 prefs_.get(),
709 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 709 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
710 extension_pref_store)); 710 GetExtensionPrefValueMap()));
711 711
712 DCHECK(!net_pref_observer_.get()); 712 DCHECK(!net_pref_observer_.get());
713 net_pref_observer_.reset(new NetPrefObserver(prefs_.get())); 713 net_pref_observer_.reset(new NetPrefObserver(prefs_.get()));
714 } 714 }
715 715
716 return prefs_.get(); 716 return prefs_.get();
717 } 717 }
718 718
719 FilePath ProfileImpl::GetPrefFilePath() { 719 FilePath ProfileImpl::GetPrefFilePath() {
720 FilePath pref_file_path = path_; 720 FilePath pref_file_path = path_;
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1189
1190 void ProfileImpl::SpellCheckHostInitialized() { 1190 void ProfileImpl::SpellCheckHostInitialized() {
1191 spellcheck_host_ready_ = spellcheck_host_ && 1191 spellcheck_host_ready_ = spellcheck_host_ &&
1192 (spellcheck_host_->bdict_file() != base::kInvalidPlatformFileValue || 1192 (spellcheck_host_->bdict_file() != base::kInvalidPlatformFileValue ||
1193 spellcheck_host_->use_platform_spellchecker()); 1193 spellcheck_host_->use_platform_spellchecker());
1194 NotificationService::current()->Notify( 1194 NotificationService::current()->Notify(
1195 NotificationType::SPELLCHECK_HOST_REINITIALIZED, 1195 NotificationType::SPELLCHECK_HOST_REINITIALIZED,
1196 Source<Profile>(this), NotificationService::NoDetails()); 1196 Source<Profile>(this), NotificationService::NoDetails());
1197 } 1197 }
1198 1198
1199 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() {
1200 if (!extension_pref_value_map_.get())
1201 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
1202 return extension_pref_value_map_.get();
1203 }
1204
1199 WebKitContext* ProfileImpl::GetWebKitContext() { 1205 WebKitContext* ProfileImpl::GetWebKitContext() {
1200 if (!webkit_context_.get()) 1206 if (!webkit_context_.get())
1201 webkit_context_ = new WebKitContext(this, clear_local_state_on_exit_); 1207 webkit_context_ = new WebKitContext(this, clear_local_state_on_exit_);
1202 DCHECK(webkit_context_.get()); 1208 DCHECK(webkit_context_.get());
1203 return webkit_context_.get(); 1209 return webkit_context_.get();
1204 } 1210 }
1205 1211
1206 DesktopNotificationService* ProfileImpl::GetDesktopNotificationService() { 1212 DesktopNotificationService* ProfileImpl::GetDesktopNotificationService() {
1207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1208 if (!desktop_notification_service_.get()) { 1214 if (!desktop_notification_service_.get()) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 } 1420 }
1415 1421
1416 PrerenderManager* ProfileImpl::GetPrerenderManager() { 1422 PrerenderManager* ProfileImpl::GetPrerenderManager() {
1417 CommandLine* cl = CommandLine::ForCurrentProcess(); 1423 CommandLine* cl = CommandLine::ForCurrentProcess();
1418 if (!cl->HasSwitch(switches::kEnablePagePrerender)) 1424 if (!cl->HasSwitch(switches::kEnablePagePrerender))
1419 return NULL; 1425 return NULL;
1420 if (!prerender_manager_) 1426 if (!prerender_manager_)
1421 prerender_manager_ = new PrerenderManager(this); 1427 prerender_manager_ = new PrerenderManager(this);
1422 return prerender_manager_; 1428 return prerender_manager_;
1423 } 1429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698