| OLD | NEW |
| 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 if (!prefs_.get()) { | 660 if (!prefs_.get()) { |
| 661 ExtensionPrefStore* extension_pref_store = new ExtensionPrefStore; | 661 ExtensionPrefStore* extension_pref_store = new ExtensionPrefStore; |
| 662 prefs_.reset(PrefService::CreatePrefService(GetPrefFilePath(), | 662 prefs_.reset(PrefService::CreatePrefService(GetPrefFilePath(), |
| 663 extension_pref_store, | 663 extension_pref_store, |
| 664 GetOriginalProfile())); | 664 GetOriginalProfile())); |
| 665 | 665 |
| 666 // The Profile class and ProfileManager class may read some prefs so | 666 // The Profile class and ProfileManager class may read some prefs so |
| 667 // register known prefs as soon as possible. | 667 // register known prefs as soon as possible. |
| 668 Profile::RegisterUserPrefs(prefs_.get()); | 668 Profile::RegisterUserPrefs(prefs_.get()); |
| 669 browser::RegisterUserPrefs(prefs_.get()); | 669 browser::RegisterUserPrefs(prefs_.get()); |
| 670 // TODO(mirandac): remove migration code after 6 months (crbug.com/69995). | |
| 671 if (g_browser_process->local_state()) { | |
| 672 browser::MigrateBrowserPrefs(prefs_.get(), | |
| 673 g_browser_process->local_state()); | |
| 674 } | |
| 675 | 670 |
| 676 // The last session exited cleanly if there is no pref for | 671 // The last session exited cleanly if there is no pref for |
| 677 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. | 672 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. |
| 678 last_session_exited_cleanly_ = | 673 last_session_exited_cleanly_ = |
| 679 prefs_->GetBoolean(prefs::kSessionExitedCleanly); | 674 prefs_->GetBoolean(prefs::kSessionExitedCleanly); |
| 680 // Mark the session as open. | 675 // Mark the session as open. |
| 681 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); | 676 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); |
| 682 // Make sure we save to disk that the session has opened. | 677 // Make sure we save to disk that the session has opened. |
| 683 prefs_->ScheduleSavePersistentPrefs(); | 678 prefs_->ScheduleSavePersistentPrefs(); |
| 684 | 679 |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 } | 1389 } |
| 1395 | 1390 |
| 1396 PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1391 PrerenderManager* ProfileImpl::GetPrerenderManager() { |
| 1397 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1392 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 1398 if (!cl->HasSwitch(switches::kEnablePagePrerender)) | 1393 if (!cl->HasSwitch(switches::kEnablePagePrerender)) |
| 1399 return NULL; | 1394 return NULL; |
| 1400 if (!prerender_manager_) | 1395 if (!prerender_manager_) |
| 1401 prerender_manager_ = new PrerenderManager(this); | 1396 prerender_manager_ = new PrerenderManager(this); |
| 1402 return prerender_manager_; | 1397 return prerender_manager_; |
| 1403 } | 1398 } |
| OLD | NEW |