| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/metrics/user_metrics.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 21 #include "chrome/browser/about_flags.h" | 22 #include "chrome/browser/about_flags.h" |
| 22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/lifetime/application_lifetime.h" | 24 #include "chrome/browser/lifetime/application_lifetime.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/profiles/profile_attributes_entry.h" | 26 #include "chrome/browser/profiles/profile_attributes_entry.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
| 41 #include "components/browser_sync/profile_sync_service.h" | 42 #include "components/browser_sync/profile_sync_service.h" |
| 42 #include "components/flags_ui/pref_service_flags_storage.h" | 43 #include "components/flags_ui/pref_service_flags_storage.h" |
| 43 #include "components/prefs/pref_service.h" | 44 #include "components/prefs/pref_service.h" |
| 44 #include "components/signin/core/browser/account_reconcilor.h" | 45 #include "components/signin/core/browser/account_reconcilor.h" |
| 45 #include "components/signin/core/browser/account_tracker_service.h" | 46 #include "components/signin/core/browser/account_tracker_service.h" |
| 46 #include "components/signin/core/browser/signin_manager.h" | 47 #include "components/signin/core/browser/signin_manager.h" |
| 47 #include "components/signin/core/common/signin_pref_names.h" | 48 #include "components/signin/core/common/signin_pref_names.h" |
| 48 #include "components/signin/core/common/signin_switches.h" | 49 #include "components/signin/core/common/signin_switches.h" |
| 49 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
| 50 #include "content/public/browser/user_metrics.h" | |
| 51 #include "extensions/features/features.h" | 51 #include "extensions/features/features.h" |
| 52 #include "net/base/escape.h" | 52 #include "net/base/escape.h" |
| 53 | 53 |
| 54 #if BUILDFLAG(ENABLE_EXTENSIONS) | 54 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 55 #include "chrome/browser/extensions/extension_service.h" | 55 #include "chrome/browser/extensions/extension_service.h" |
| 56 #include "extensions/browser/extension_prefs.h" | 56 #include "extensions/browser/extension_prefs.h" |
| 57 #include "extensions/browser/extension_registry.h" | 57 #include "extensions/browser/extension_registry.h" |
| 58 #include "extensions/browser/extension_registry_factory.h" | 58 #include "extensions/browser/extension_registry_factory.h" |
| 59 #include "extensions/browser/extension_system.h" | 59 #include "extensions/browser/extension_system.h" |
| 60 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 60 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 DCHECK(profile); | 213 DCHECK(profile); |
| 214 | 214 |
| 215 if (!always_create) { | 215 if (!always_create) { |
| 216 Browser* browser = chrome::FindTabbedBrowser(profile, false); | 216 Browser* browser = chrome::FindTabbedBrowser(profile, false); |
| 217 if (browser) { | 217 if (browser) { |
| 218 browser->window()->Activate(); | 218 browser->window()->Activate(); |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 content::RecordAction(UserMetricsAction("NewWindow")); | 223 base::RecordAction(UserMetricsAction("NewWindow")); |
| 224 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 224 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 225 StartupBrowserCreator browser_creator; | 225 StartupBrowserCreator browser_creator; |
| 226 browser_creator.LaunchBrowser( | 226 browser_creator.LaunchBrowser( |
| 227 command_line, profile, base::FilePath(), process_startup, is_first_run); | 227 command_line, profile, base::FilePath(), process_startup, is_first_run); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void OpenBrowserWindowForProfile( | 230 void OpenBrowserWindowForProfile( |
| 231 ProfileManager::CreateCallback callback, | 231 ProfileManager::CreateCallback callback, |
| 232 bool always_create, | 232 bool always_create, |
| 233 bool is_new_profile, | 233 bool is_new_profile, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 PrefService* local_state = g_browser_process->local_state(); | 524 PrefService* local_state = g_browser_process->local_state(); |
| 525 const bool dismissed = local_state->GetBoolean( | 525 const bool dismissed = local_state->GetBoolean( |
| 526 prefs::kProfileAvatarRightClickTutorialDismissed); | 526 prefs::kProfileAvatarRightClickTutorialDismissed); |
| 527 | 527 |
| 528 // Don't show the tutorial if it's already been dismissed or if right-clicking | 528 // Don't show the tutorial if it's already been dismissed or if right-clicking |
| 529 // wouldn't show any targets. | 529 // wouldn't show any targets. |
| 530 return !dismissed && HasProfileSwitchTargets(profile); | 530 return !dismissed && HasProfileSwitchTargets(profile); |
| 531 } | 531 } |
| 532 | 532 |
| 533 } // namespace profiles | 533 } // namespace profiles |
| OLD | NEW |