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

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: Addressed Mattias' feedback 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) 2010 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 "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 new TransportSecurityPersister(); 654 new TransportSecurityPersister();
655 transport_security_persister_->Initialize( 655 transport_security_persister_->Initialize(
656 transport_security_state_.get(), path_); 656 transport_security_state_.get(), path_);
657 } 657 }
658 658
659 return transport_security_state_.get(); 659 return transport_security_state_.get();
660 } 660 }
661 661
662 PrefService* ProfileImpl::GetPrefs() { 662 PrefService* ProfileImpl::GetPrefs() {
663 if (!prefs_.get()) { 663 if (!prefs_.get()) {
664 ExtensionPrefStore* extension_pref_store = new ExtensionPrefStore; 664 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
665 prefs_.reset(PrefService::CreatePrefService(GetPrefFilePath(), 665 prefs_.reset(PrefService::CreatePrefService(
666 extension_pref_store, 666 GetPrefFilePath(),
667 GetOriginalProfile())); 667 new ExtensionPrefStore(extension_pref_value_map_.get(), false),
668 GetOriginalProfile()));
668 669
669 // The Profile class and ProfileManager class may read some prefs so 670 // The Profile class and ProfileManager class may read some prefs so
670 // register known prefs as soon as possible. 671 // register known prefs as soon as possible.
671 Profile::RegisterUserPrefs(prefs_.get()); 672 Profile::RegisterUserPrefs(prefs_.get());
672 browser::RegisterUserPrefs(prefs_.get()); 673 browser::RegisterUserPrefs(prefs_.get());
673 674
674 // The last session exited cleanly if there is no pref for 675 // The last session exited cleanly if there is no pref for
675 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. 676 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true.
676 last_session_exited_cleanly_ = 677 last_session_exited_cleanly_ =
677 prefs_->GetBoolean(prefs::kSessionExitedCleanly); 678 prefs_->GetBoolean(prefs::kSessionExitedCleanly);
678 // Mark the session as open. 679 // Mark the session as open.
679 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); 680 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false);
680 // Make sure we save to disk that the session has opened. 681 // Make sure we save to disk that the session has opened.
681 prefs_->ScheduleSavePersistentPrefs(); 682 prefs_->ScheduleSavePersistentPrefs();
682 683
683 // Ensure that preferences set by extensions are restored in the profile 684 // Ensure that preferences set by extensions are restored in the profile
684 // as early as possible. The constructor takes care of that. 685 // as early as possible. The constructor takes care of that.
686
Mattias Nissler (ping if slow) 2011/01/07 10:12:58 Why this newline?
battre 2011/01/10 16:55:47 Done.
685 extension_prefs_.reset(new ExtensionPrefs( 687 extension_prefs_.reset(new ExtensionPrefs(
686 prefs_.get(), 688 prefs_.get(),
687 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 689 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
688 extension_pref_store)); 690 extension_pref_value_map_.get()));
689 691
690 DCHECK(!net_pref_observer_.get()); 692 DCHECK(!net_pref_observer_.get());
691 net_pref_observer_.reset(new NetPrefObserver(prefs_.get())); 693 net_pref_observer_.reset(new NetPrefObserver(prefs_.get()));
692 } 694 }
693 695
694 return prefs_.get(); 696 return prefs_.get();
695 } 697 }
696 698
697 FilePath ProfileImpl::GetPrefFilePath() { 699 FilePath ProfileImpl::GetPrefFilePath() {
698 FilePath pref_file_path = path_; 700 FilePath pref_file_path = path_;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 } 1365 }
1364 1366
1365 PrerenderManager* ProfileImpl::GetPrerenderManager() { 1367 PrerenderManager* ProfileImpl::GetPrerenderManager() {
1366 CommandLine* cl = CommandLine::ForCurrentProcess(); 1368 CommandLine* cl = CommandLine::ForCurrentProcess();
1367 if (!cl->HasSwitch(switches::kEnablePagePrerender)) 1369 if (!cl->HasSwitch(switches::kEnablePagePrerender))
1368 return NULL; 1370 return NULL;
1369 if (!prerender_manager_.get()) 1371 if (!prerender_manager_.get())
1370 prerender_manager_.reset(new PrerenderManager(this)); 1372 prerender_manager_.reset(new PrerenderManager(this));
1371 return prerender_manager_.get(); 1373 return prerender_manager_.get();
1372 } 1374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698