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

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

Issue 7717025: Do not initialize event routers in the Profile Import process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: reset will_import_ value when import complete. Created 9 years, 4 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
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 5 #include <set>
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 // static 98 // static
99 Profile* ProfileManager::GetLastUsedProfile() { 99 Profile* ProfileManager::GetLastUsedProfile() {
100 FilePath user_data_dir; 100 FilePath user_data_dir;
101 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 101 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
102 ProfileManager* profile_manager = g_browser_process->profile_manager(); 102 ProfileManager* profile_manager = g_browser_process->profile_manager();
103 return profile_manager->GetLastUsedProfile(user_data_dir); 103 return profile_manager->GetLastUsedProfile(user_data_dir);
104 } 104 }
105 105
106 ProfileManager::ProfileManager() : logged_in_(false) { 106 ProfileManager::ProfileManager() : logged_in_(false),
107 will_import_(false) {
107 BrowserList::AddObserver(this); 108 BrowserList::AddObserver(this);
108 #if defined(OS_CHROMEOS) 109 #if defined(OS_CHROMEOS)
109 registrar_.Add( 110 registrar_.Add(
110 this, 111 this,
111 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 112 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
112 NotificationService::AllSources()); 113 NotificationService::AllSources());
113 #endif 114 #endif
114 } 115 }
115 116
116 ProfileManager::~ProfileManager() { 117 ProfileManager::~ProfileManager() {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // TODO(davemoore) Once we have better api this check should ensure that 334 // TODO(davemoore) Once we have better api this check should ensure that
334 // our profile directory is the one that's mounted, and that it's mounted 335 // our profile directory is the one that's mounted, and that it's mounted
335 // as the current user. 336 // as the current user.
336 CHECK(chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()->IsMounted()); 337 CHECK(chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()->IsMounted());
337 } 338 }
338 logged_in_ = true; 339 logged_in_ = true;
339 } 340 }
340 #endif 341 #endif
341 } 342 }
342 343
344 void ProfileManager::SetWillImport() {
345 will_import_ = true;
346 }
347
348 void ProfileManager::OnImportFinished(Profile* profile) {
349 will_import_ = false;
350 DCHECK(profile);
351 NotificationService::current()->Notify(
352 chrome::NOTIFICATION_IMPORT_FINISHED,
353 Source<Profile>(profile),
354 NotificationService::NoDetails());
355 }
356
343 void ProfileManager::OnBrowserAdded(const Browser* browser) {} 357 void ProfileManager::OnBrowserAdded(const Browser* browser) {}
344 358
345 void ProfileManager::OnBrowserRemoved(const Browser* browser) {} 359 void ProfileManager::OnBrowserRemoved(const Browser* browser) {}
346 360
347 void ProfileManager::OnBrowserSetLastActive(const Browser* browser) { 361 void ProfileManager::OnBrowserSetLastActive(const Browser* browser) {
348 Profile* last_active = browser->GetProfile(); 362 Profile* last_active = browser->GetProfile();
349 PrefService* local_state = g_browser_process->local_state(); 363 PrefService* local_state = g_browser_process->local_state();
350 DCHECK(local_state); 364 DCHECK(local_state);
351 // Only keep track of profiles that we are managing; tests may create others. 365 // Only keep track of profiles that we are managing; tests may create others.
352 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { 366 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 cache.DeleteProfileFromCache(profile_dir); 571 cache.DeleteProfileFromCache(profile_dir);
558 } 572 }
559 573
560 // static 574 // static
561 bool ProfileManager::IsMultipleProfilesEnabled() { 575 bool ProfileManager::IsMultipleProfilesEnabled() {
562 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) 576 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)
563 return true; 577 return true;
564 #endif 578 #endif
565 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); 579 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles);
566 } 580 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698