| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Called upon completion of profile creation. This function takes care of | 145 // Called upon completion of profile creation. This function takes care of |
| 146 // launching a new browser window and signing the user in to their Google | 146 // launching a new browser window and signing the user in to their Google |
| 147 // account. | 147 // account. |
| 148 void OnOpenWindowForNewProfile(Profile* profile, | 148 void OnOpenWindowForNewProfile(Profile* profile, |
| 149 Profile::CreateStatus status) { | 149 Profile::CreateStatus status) { |
| 150 if (status == Profile::CREATE_STATUS_INITIALIZED) { | 150 if (status == Profile::CREATE_STATUS_INITIALIZED) { |
| 151 ProfileManager::FindOrCreateNewWindowForProfile( | 151 ProfileManager::FindOrCreateNewWindowForProfile( |
| 152 profile, | 152 profile, |
| 153 BrowserInit::IS_PROCESS_STARTUP, | 153 StartupBrowserCreator::IS_PROCESS_STARTUP, |
| 154 BrowserInit::IS_FIRST_RUN, | 154 StartupBrowserCreator::IS_FIRST_RUN, |
| 155 false); | 155 false); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace | 159 } // namespace |
| 160 | 160 |
| 161 #if defined(ENABLE_SESSION_SERVICE) | 161 #if defined(ENABLE_SESSION_SERVICE) |
| 162 // static | 162 // static |
| 163 void ProfileManager::ShutdownSessionServices() { | 163 void ProfileManager::ShutdownSessionServices() { |
| 164 ProfileManager* pm = g_browser_process->profile_manager(); | 164 ProfileManager* pm = g_browser_process->profile_manager(); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 } | 462 } |
| 463 | 463 |
| 464 Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { | 464 Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { |
| 465 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); | 465 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); |
| 466 return (iter == profiles_info_.end()) ? NULL : iter->second->profile.get(); | 466 return (iter == profiles_info_.end()) ? NULL : iter->second->profile.get(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 // static | 469 // static |
| 470 void ProfileManager::FindOrCreateNewWindowForProfile( | 470 void ProfileManager::FindOrCreateNewWindowForProfile( |
| 471 Profile* profile, | 471 Profile* profile, |
| 472 BrowserInit::IsProcessStartup process_startup, | 472 StartupBrowserCreator::IsProcessStartup process_startup, |
| 473 BrowserInit::IsFirstRun is_first_run, | 473 StartupBrowserCreator::IsFirstRun is_first_run, |
| 474 bool always_create) { | 474 bool always_create) { |
| 475 DCHECK(profile); | 475 DCHECK(profile); |
| 476 | 476 |
| 477 if (!always_create) { | 477 if (!always_create) { |
| 478 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); | 478 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); |
| 479 if (browser) { | 479 if (browser) { |
| 480 browser->window()->Activate(); | 480 browser->window()->Activate(); |
| 481 return; | 481 return; |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 | 484 |
| 485 content::RecordAction(UserMetricsAction("NewWindow")); | 485 content::RecordAction(UserMetricsAction("NewWindow")); |
| 486 CommandLine command_line(CommandLine::NO_PROGRAM); | 486 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 487 int return_code; | 487 int return_code; |
| 488 BrowserInit browser_init; | 488 StartupBrowserCreator browser_creator; |
| 489 browser_init.LaunchBrowser(command_line, profile, FilePath(), | 489 browser_creator.LaunchBrowser(command_line, profile, FilePath(), |
| 490 process_startup, is_first_run, &return_code); | 490 process_startup, is_first_run, &return_code); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void ProfileManager::Observe( | 493 void ProfileManager::Observe( |
| 494 int type, | 494 int type, |
| 495 const content::NotificationSource& source, | 495 const content::NotificationSource& source, |
| 496 const content::NotificationDetails& details) { | 496 const content::NotificationDetails& details) { |
| 497 #if defined(OS_CHROMEOS) | 497 #if defined(OS_CHROMEOS) |
| 498 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { | 498 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { |
| 499 logged_in_ = true; | 499 logged_in_ = true; |
| 500 | 500 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 AddProfileToCache(profile); | 966 AddProfileToCache(profile); |
| 967 } | 967 } |
| 968 } | 968 } |
| 969 | 969 |
| 970 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 970 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 971 Profile* profile, | 971 Profile* profile, |
| 972 Profile::CreateStatus status) { | 972 Profile::CreateStatus status) { |
| 973 for (size_t i = 0; i < callbacks.size(); ++i) | 973 for (size_t i = 0; i < callbacks.size(); ++i) |
| 974 callbacks[i].Run(profile, status); | 974 callbacks[i].Run(profile, status); |
| 975 } | 975 } |
| OLD | NEW |