| 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 "chrome/browser/ui/startup/startup_browser_creator.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "apps/app_load_service.h" | 10 #include "apps/app_load_service.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 void ActivateProfile() { | 202 void ActivateProfile() { |
| 203 // We need to test again, in case the profile got deleted in the mean time. | 203 // We need to test again, in case the profile got deleted in the mean time. |
| 204 if (profile_to_activate_) { | 204 if (profile_to_activate_) { |
| 205 Browser* browser = chrome::FindBrowserWithProfile( | 205 Browser* browser = chrome::FindBrowserWithProfile( |
| 206 profile_to_activate_, chrome::HOST_DESKTOP_TYPE_NATIVE); | 206 profile_to_activate_, chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 207 // |profile| may never get launched, e.g., if it only had | 207 // |profile| may never get launched, e.g., if it only had |
| 208 // incognito Windows and one of them was used to exit Chrome. | 208 // incognito Windows and one of them was used to exit Chrome. |
| 209 // So it won't have a browser in that case. | 209 // So it won't have a browser in that case. |
| 210 if (browser) | 210 if (browser) |
| 211 browser->window()->Activate(); | 211 browser->window()->Activate(true /* user_gesture */); |
| 212 // No need try to activate this profile again. | 212 // No need try to activate this profile again. |
| 213 profile_to_activate_ = NULL; | 213 profile_to_activate_ = NULL; |
| 214 } | 214 } |
| 215 // Assign true here, even if no browser was actually activated, so that | 215 // Assign true here, even if no browser was actually activated, so that |
| 216 // the test can stop waiting, and fail gracefully when needed. | 216 // the test can stop waiting, and fail gracefully when needed. |
| 217 activated_profile_ = true; | 217 activated_profile_ = true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 // These are the profiles that get launched by | 220 // These are the profiles that get launched by |
| 221 // StartupBrowserCreator::LaunchBrowser. | 221 // StartupBrowserCreator::LaunchBrowser. |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 // If we are showing the app list then chrome isn't shown so load the app | 849 // If we are showing the app list then chrome isn't shown so load the app |
| 850 // list's profile rather than chrome's. | 850 // list's profile rather than chrome's. |
| 851 if (command_line.HasSwitch(switches::kShowAppList)) { | 851 if (command_line.HasSwitch(switches::kShowAppList)) { |
| 852 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 852 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
| 853 GetProfilePath(user_data_dir); | 853 GetProfilePath(user_data_dir); |
| 854 } | 854 } |
| 855 | 855 |
| 856 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 856 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
| 857 user_data_dir); | 857 user_data_dir); |
| 858 } | 858 } |
| OLD | NEW |