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

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

Issue 7285014: [wip] Profile: Sketch of a creation system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Y U NO LIEK CONST, MAC? Created 9 years, 5 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/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 start_time_(Time::Now()), 288 start_time_(Time::Now()),
289 spellcheck_host_(NULL), 289 spellcheck_host_(NULL),
290 spellcheck_host_ready_(false), 290 spellcheck_host_ready_(false),
291 #if defined(OS_WIN) 291 #if defined(OS_WIN)
292 checked_instant_promo_(false), 292 checked_instant_promo_(false),
293 #endif 293 #endif
294 delegate_(delegate) { 294 delegate_(delegate) {
295 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << 295 DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
296 "profile files to the root directory!"; 296 "profile files to the root directory!";
297 297
298 #ifndef NDEBUG
299 ProfileDependencyManager::GetInstance()->ProfileNowExists(this);
300 #endif
301
302 create_session_service_timer_.Start( 298 create_session_service_timer_.Start(
303 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, 299 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
304 &ProfileImpl::EnsureSessionServiceCreated); 300 &ProfileImpl::EnsureSessionServiceCreated);
Elliot Glaysher 2011/06/30 23:55:03 Why do we do this? Things seem to work if I leave
Miranda Callahan 2011/07/01 15:20:24 Good question. I tracked through the code and saw
305 301
306 if (delegate_) { 302 if (delegate_) {
307 prefs_.reset(PrefService::CreatePrefService( 303 prefs_.reset(PrefService::CreatePrefService(
308 GetPrefFilePath(), 304 GetPrefFilePath(),
309 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), 305 new ExtensionPrefStore(GetExtensionPrefValueMap(), false),
310 true)); 306 true));
311 // Wait for the notifcation that prefs has been loaded (successfully or 307 // Wait for the notifcation that prefs has been loaded (successfully or
312 // not). 308 // not).
313 registrar_.Add(this, NotificationType::PREF_INITIALIZATION_COMPLETED, 309 registrar_.Add(this, NotificationType::PREF_INITIALIZATION_COMPLETED,
314 Source<PrefService>(prefs_.get())); 310 Source<PrefService>(prefs_.get()));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // Initialize the BackgroundModeManager - this has to be done here before 360 // Initialize the BackgroundModeManager - this has to be done here before
365 // InitExtensions() is called because it relies on receiving notifications 361 // InitExtensions() is called because it relies on receiving notifications
366 // when extensions are loaded. BackgroundModeManager is not needed under 362 // when extensions are loaded. BackgroundModeManager is not needed under
367 // ChromeOS because Chrome is always running (no need for special keep-alive 363 // ChromeOS because Chrome is always running (no need for special keep-alive
368 // or launch-on-startup support). 364 // or launch-on-startup support).
369 #if !defined(OS_CHROMEOS) 365 #if !defined(OS_CHROMEOS)
370 if (g_browser_process->background_mode_manager()) 366 if (g_browser_process->background_mode_manager())
371 g_browser_process->background_mode_manager()->RegisterProfile(this); 367 g_browser_process->background_mode_manager()->RegisterProfile(this);
372 #endif 368 #endif
373 369
374 BackgroundContentsServiceFactory::GetForProfile(this); 370 BackgroundContentsServiceFactory::GetForProfile(this);
Miranda Callahan 2011/07/01 15:20:24 Should be removed, along with a few other factory
Elliot Glaysher 2011/07/01 17:29:45 I'm going to ignore the PinnedTabServiceFactory ca
375 371
376 extension_info_map_ = new ExtensionInfoMap(); 372 extension_info_map_ = new ExtensionInfoMap();
377 373
378 InitRegisteredProtocolHandlers(); 374 InitRegisteredProtocolHandlers();
379 375
380 clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit); 376 clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit);
381 if (clear_local_state_on_exit_) { 377 if (clear_local_state_on_exit_) {
382 UserMetrics::RecordAction( 378 UserMetrics::RecordAction(
383 UserMetricsAction("ClearSiteDataOnExitEnabled")); 379 UserMetricsAction("ClearSiteDataOnExitEnabled"));
384 } else { 380 } else {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 808
813 // The last session exited cleanly if there is no pref for 809 // The last session exited cleanly if there is no pref for
814 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. 810 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true.
815 last_session_exited_cleanly_ = 811 last_session_exited_cleanly_ =
816 prefs_->GetBoolean(prefs::kSessionExitedCleanly); 812 prefs_->GetBoolean(prefs::kSessionExitedCleanly);
817 // Mark the session as open. 813 // Mark the session as open.
818 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); 814 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false);
819 // Make sure we save to disk that the session has opened. 815 // Make sure we save to disk that the session has opened.
820 prefs_->ScheduleSavePersistentPrefs(); 816 prefs_->ScheduleSavePersistentPrefs();
821 817
818 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false);
819
822 // Ensure that preferences set by extensions are restored in the profile 820 // Ensure that preferences set by extensions are restored in the profile
823 // as early as possible. The constructor takes care of that. 821 // as early as possible. The constructor takes care of that.
824 extension_prefs_.reset(new ExtensionPrefs( 822 extension_prefs_.reset(new ExtensionPrefs(
825 prefs_.get(), 823 prefs_.get(),
826 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 824 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
827 GetExtensionPrefValueMap())); 825 GetExtensionPrefValueMap()));
828 826
829 DCHECK(!net_pref_observer_.get()); 827 DCHECK(!net_pref_observer_.get());
830 net_pref_observer_.reset( 828 net_pref_observer_.reset(
831 new NetPrefObserver(prefs_.get(), GetPrerenderManager())); 829 new NetPrefObserver(prefs_.get(), GetPrerenderManager()));
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 if (!prerender::PrerenderManager::IsPrerenderingPossible()) 1640 if (!prerender::PrerenderManager::IsPrerenderingPossible())
1643 return NULL; 1641 return NULL;
1644 if (!prerender_manager_.get()) { 1642 if (!prerender_manager_.get()) {
1645 CHECK(g_browser_process->prerender_tracker()); 1643 CHECK(g_browser_process->prerender_tracker());
1646 prerender_manager_.reset( 1644 prerender_manager_.reset(
1647 new prerender::PrerenderManager( 1645 new prerender::PrerenderManager(
1648 this, g_browser_process->prerender_tracker())); 1646 this, g_browser_process->prerender_tracker()));
1649 } 1647 }
1650 return prerender_manager_.get(); 1648 return prerender_manager_.get();
1651 } 1649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698