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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/managed_mode.h" | 22 #include "chrome/browser/managed_mode.h" |
23 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" |
24 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
25 #include "chrome/browser/profiles/profile_info_cache.h" | 25 #include "chrome/browser/profiles/profile_info_cache.h" |
26 #include "chrome/browser/profiles/profile_metrics.h" | 26 #include "chrome/browser/profiles/profile_metrics.h" |
27 #include "chrome/browser/sessions/session_service_factory.h" | 27 #include "chrome/browser/sessions/session_service_factory.h" |
28 #include "chrome/browser/sync/profile_sync_service.h" | 28 #include "chrome/browser/sync/profile_sync_service.h" |
29 #include "chrome/browser/sync/profile_sync_service_factory.h" | 29 #include "chrome/browser/sync/profile_sync_service_factory.h" |
30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
31 #include "chrome/browser/ui/browser_window.h" | 31 #include "chrome/browser/ui/browser_window.h" |
32 #include "chrome/browser/ui/startup/startup_browser_creator.h" | |
33 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 32 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
34 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
35 #include "chrome/common/chrome_notification_types.h" | 34 #include "chrome/common/chrome_notification_types.h" |
36 #include "chrome/common/chrome_paths_internal.h" | 35 #include "chrome/common/chrome_paths_internal.h" |
37 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/common/logging_chrome.h" | 37 #include "chrome/common/logging_chrome.h" |
39 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
40 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
41 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
42 #include "chrome/installer/util/browser_distribution.h" | 41 #include "chrome/installer/util/browser_distribution.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 143 } |
145 | 144 |
146 // Called upon completion of profile creation. This function takes care of | 145 // Called upon completion of profile creation. This function takes care of |
147 // 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 |
148 // account. | 147 // account. |
149 void OnOpenWindowForNewProfile(Profile* profile, | 148 void OnOpenWindowForNewProfile(Profile* profile, |
150 Profile::CreateStatus status) { | 149 Profile::CreateStatus status) { |
151 if (status == Profile::CREATE_STATUS_INITIALIZED) { | 150 if (status == Profile::CREATE_STATUS_INITIALIZED) { |
152 ProfileManager::FindOrCreateNewWindowForProfile( | 151 ProfileManager::FindOrCreateNewWindowForProfile( |
153 profile, | 152 profile, |
154 browser::startup::IS_PROCESS_STARTUP, | 153 StartupBrowserCreator::IS_PROCESS_STARTUP, |
155 browser::startup::IS_FIRST_RUN, | 154 StartupBrowserCreator::IS_FIRST_RUN, |
156 false); | 155 false); |
157 } | 156 } |
158 } | 157 } |
159 | 158 |
160 } // namespace | 159 } // namespace |
161 | 160 |
162 #if defined(ENABLE_SESSION_SERVICE) | 161 #if defined(ENABLE_SESSION_SERVICE) |
163 // static | 162 // static |
164 void ProfileManager::ShutdownSessionServices() { | 163 void ProfileManager::ShutdownSessionServices() { |
165 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... |
463 } | 462 } |
464 | 463 |
465 Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { | 464 Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { |
466 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); | 465 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); |
467 return (iter == profiles_info_.end()) ? NULL : iter->second->profile.get(); | 466 return (iter == profiles_info_.end()) ? NULL : iter->second->profile.get(); |
468 } | 467 } |
469 | 468 |
470 // static | 469 // static |
471 void ProfileManager::FindOrCreateNewWindowForProfile( | 470 void ProfileManager::FindOrCreateNewWindowForProfile( |
472 Profile* profile, | 471 Profile* profile, |
473 browser::startup::IsProcessStartup process_startup, | 472 StartupBrowserCreator::IsProcessStartup process_startup, |
474 browser::startup::IsFirstRun is_first_run, | 473 StartupBrowserCreator::IsFirstRun is_first_run, |
475 bool always_create) { | 474 bool always_create) { |
476 DCHECK(profile); | 475 DCHECK(profile); |
477 | 476 |
478 if (!always_create) { | 477 if (!always_create) { |
479 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); | 478 Browser* browser = BrowserList::FindTabbedBrowser(profile, false); |
480 if (browser) { | 479 if (browser) { |
481 browser->window()->Activate(); | 480 browser->window()->Activate(); |
482 return; | 481 return; |
483 } | 482 } |
484 } | 483 } |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 AddProfileToCache(profile); | 966 AddProfileToCache(profile); |
968 } | 967 } |
969 } | 968 } |
970 | 969 |
971 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 970 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
972 Profile* profile, | 971 Profile* profile, |
973 Profile::CreateStatus status) { | 972 Profile::CreateStatus status) { |
974 for (size_t i = 0; i < callbacks.size(); ++i) | 973 for (size_t i = 0; i < callbacks.size(); ++i) |
975 callbacks[i].Run(profile, status); | 974 callbacks[i].Run(profile, status); |
976 } | 975 } |
OLD | NEW |