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