| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 UnblockExtensions(profile); | 149 UnblockExtensions(profile); |
| 150 } | 150 } |
| 151 #endif // defined(ENABLE_EXTENSIONS) | 151 #endif // defined(ENABLE_EXTENSIONS) |
| 152 | 152 |
| 153 // If |always_create| is false, and we have a |callback| to run, check | 153 // If |always_create| is false, and we have a |callback| to run, check |
| 154 // whether a browser already exists so that we can run the callback. We don't | 154 // whether a browser already exists so that we can run the callback. We don't |
| 155 // want to rely on the observer listening to OnBrowserSetLastActive in this | 155 // want to rely on the observer listening to OnBrowserSetLastActive in this |
| 156 // case, as you could manually activate an incorrect browser and trigger | 156 // case, as you could manually activate an incorrect browser and trigger |
| 157 // a false positive. | 157 // a false positive. |
| 158 if (!always_create) { | 158 if (!always_create) { |
| 159 Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type); | 159 Browser* browser = chrome::FindTabbedBrowser(profile, false); |
| 160 if (browser) { | 160 if (browser) { |
| 161 browser->window()->Activate(); | 161 browser->window()->Activate(); |
| 162 if (!callback.is_null()) | 162 if (!callback.is_null()) |
| 163 callback.Run(profile, Profile::CREATE_STATUS_INITIALIZED); | 163 callback.Run(profile, Profile::CREATE_STATUS_INITIALIZED); |
| 164 return; | 164 return; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 // If there is a callback, create an observer to make sure it is only | 168 // If there is a callback, create an observer to make sure it is only |
| 169 // run when the browser has been completely created. This observer will | 169 // run when the browser has been completely created. This observer will |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 void FindOrCreateNewWindowForProfile( | 269 void FindOrCreateNewWindowForProfile( |
| 270 Profile* profile, | 270 Profile* profile, |
| 271 chrome::startup::IsProcessStartup process_startup, | 271 chrome::startup::IsProcessStartup process_startup, |
| 272 chrome::startup::IsFirstRun is_first_run, | 272 chrome::startup::IsFirstRun is_first_run, |
| 273 chrome::HostDesktopType desktop_type, | 273 chrome::HostDesktopType desktop_type, |
| 274 bool always_create) { | 274 bool always_create) { |
| 275 DCHECK(profile); | 275 DCHECK(profile); |
| 276 | 276 |
| 277 if (!always_create) { | 277 if (!always_create) { |
| 278 Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type); | 278 Browser* browser = chrome::FindTabbedBrowser(profile, false); |
| 279 if (browser) { | 279 if (browser) { |
| 280 browser->window()->Activate(); | 280 browser->window()->Activate(); |
| 281 return; | 281 return; |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 content::RecordAction(UserMetricsAction("NewWindow")); | 285 content::RecordAction(UserMetricsAction("NewWindow")); |
| 286 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 286 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 287 StartupBrowserCreator browser_creator; | 287 StartupBrowserCreator browser_creator; |
| 288 browser_creator.LaunchBrowser( | 288 browser_creator.LaunchBrowser( |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 PrefService* local_state = g_browser_process->local_state(); | 559 PrefService* local_state = g_browser_process->local_state(); |
| 560 const bool dismissed = local_state->GetBoolean( | 560 const bool dismissed = local_state->GetBoolean( |
| 561 prefs::kProfileAvatarRightClickTutorialDismissed); | 561 prefs::kProfileAvatarRightClickTutorialDismissed); |
| 562 | 562 |
| 563 // Don't show the tutorial if it's already been dismissed or if right-clicking | 563 // Don't show the tutorial if it's already been dismissed or if right-clicking |
| 564 // wouldn't show any targets. | 564 // wouldn't show any targets. |
| 565 return !dismissed && HasProfileSwitchTargets(profile); | 565 return !dismissed && HasProfileSwitchTargets(profile); |
| 566 } | 566 } |
| 567 | 567 |
| 568 } // namespace profiles | 568 } // namespace profiles |
| OLD | NEW |