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

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: Continued work from last year 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 ExtensionPrefStore* extension_pref_store = new ExtensionPrefStore(false);
665 ExtensionPrefStore* incognito_extension_pref_store =
666 new ExtensionPrefStore(true);
665 prefs_.reset(PrefService::CreatePrefService(GetPrefFilePath(), 667 prefs_.reset(PrefService::CreatePrefService(GetPrefFilePath(),
666 extension_pref_store, 668 extension_pref_store,
667 GetOriginalProfile())); 669 GetOriginalProfile()));
668 670
669 // The Profile class and ProfileManager class may read some prefs so 671 // The Profile class and ProfileManager class may read some prefs so
670 // register known prefs as soon as possible. 672 // register known prefs as soon as possible.
671 Profile::RegisterUserPrefs(prefs_.get()); 673 Profile::RegisterUserPrefs(prefs_.get());
672 browser::RegisterUserPrefs(prefs_.get()); 674 browser::RegisterUserPrefs(prefs_.get());
673 675
674 // The last session exited cleanly if there is no pref for 676 // The last session exited cleanly if there is no pref for
675 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. 677 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true.
676 last_session_exited_cleanly_ = 678 last_session_exited_cleanly_ =
677 prefs_->GetBoolean(prefs::kSessionExitedCleanly); 679 prefs_->GetBoolean(prefs::kSessionExitedCleanly);
678 // Mark the session as open. 680 // Mark the session as open.
679 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); 681 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false);
680 // Make sure we save to disk that the session has opened. 682 // Make sure we save to disk that the session has opened.
681 prefs_->ScheduleSavePersistentPrefs(); 683 prefs_->ScheduleSavePersistentPrefs();
682 684
683 // Ensure that preferences set by extensions are restored in the profile 685 // Ensure that preferences set by extensions are restored in the profile
684 // as early as possible. The constructor takes care of that. 686 // as early as possible. The constructor takes care of that.
687
685 extension_prefs_.reset(new ExtensionPrefs( 688 extension_prefs_.reset(new ExtensionPrefs(
686 prefs_.get(), 689 prefs_.get(),
687 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 690 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
688 extension_pref_store)); 691 extension_pref_store,
692 incognito_extension_pref_store));
689 693
690 DCHECK(!net_pref_observer_.get()); 694 DCHECK(!net_pref_observer_.get());
691 net_pref_observer_.reset(new NetPrefObserver(prefs_.get())); 695 net_pref_observer_.reset(new NetPrefObserver(prefs_.get()));
692 } 696 }
693 697
694 return prefs_.get(); 698 return prefs_.get();
695 } 699 }
696 700
697 FilePath ProfileImpl::GetPrefFilePath() { 701 FilePath ProfileImpl::GetPrefFilePath() {
698 FilePath pref_file_path = path_; 702 FilePath pref_file_path = path_;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 } 1367 }
1364 1368
1365 PrerenderManager* ProfileImpl::GetPrerenderManager() { 1369 PrerenderManager* ProfileImpl::GetPrerenderManager() {
1366 CommandLine* cl = CommandLine::ForCurrentProcess(); 1370 CommandLine* cl = CommandLine::ForCurrentProcess();
1367 if (!cl->HasSwitch(switches::kEnablePagePrerender)) 1371 if (!cl->HasSwitch(switches::kEnablePagePrerender))
1368 return NULL; 1372 return NULL;
1369 if (!prerender_manager_.get()) 1373 if (!prerender_manager_.get())
1370 prerender_manager_.reset(new PrerenderManager(this)); 1374 prerender_manager_.reset(new PrerenderManager(this));
1371 return prerender_manager_.get(); 1375 return prerender_manager_.get();
1372 } 1376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698