| 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 <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include <algorithm>  // For max(). | 9 #include <algorithm>  // For max(). | 
| 10 #include <memory> | 10 #include <memory> | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 43 #include "chrome/browser/first_run/first_run.h" | 43 #include "chrome/browser/first_run/first_run.h" | 
| 44 #include "chrome/browser/net/predictor.h" | 44 #include "chrome/browser/net/predictor.h" | 
| 45 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 45 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 
| 46 #include "chrome/browser/prefs/session_startup_pref.h" | 46 #include "chrome/browser/prefs/session_startup_pref.h" | 
| 47 #include "chrome/browser/profiles/profile.h" | 47 #include "chrome/browser/profiles/profile.h" | 
| 48 #include "chrome/browser/profiles/profile_attributes_entry.h" | 48 #include "chrome/browser/profiles/profile_attributes_entry.h" | 
| 49 #include "chrome/browser/profiles/profile_attributes_storage.h" | 49 #include "chrome/browser/profiles/profile_attributes_storage.h" | 
| 50 #include "chrome/browser/profiles/profile_manager.h" | 50 #include "chrome/browser/profiles/profile_manager.h" | 
| 51 #include "chrome/browser/profiles/profiles_state.h" | 51 #include "chrome/browser/profiles/profiles_state.h" | 
| 52 #include "chrome/browser/search_engines/template_url_service_factory.h" | 52 #include "chrome/browser/search_engines/template_url_service_factory.h" | 
| 53 #include "chrome/browser/ui/app_list/app_list_service.h" |  | 
| 54 #include "chrome/browser/ui/browser.h" | 53 #include "chrome/browser/ui/browser.h" | 
| 55 #include "chrome/browser/ui/browser_dialogs.h" | 54 #include "chrome/browser/ui/browser_dialogs.h" | 
| 56 #include "chrome/browser/ui/browser_finder.h" | 55 #include "chrome/browser/ui/browser_finder.h" | 
| 57 #include "chrome/browser/ui/browser_window.h" | 56 #include "chrome/browser/ui/browser_window.h" | 
| 58 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 57 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 
| 59 #include "chrome/browser/ui/user_manager.h" | 58 #include "chrome/browser/ui/user_manager.h" | 
| 60 #include "chrome/common/chrome_constants.h" | 59 #include "chrome/common/chrome_constants.h" | 
| 61 #include "chrome/common/chrome_paths.h" | 60 #include "chrome/common/chrome_paths.h" | 
| 62 #include "chrome/common/chrome_result_codes.h" | 61 #include "chrome/common/chrome_result_codes.h" | 
| 63 #include "chrome/common/chrome_switches.h" | 62 #include "chrome/common/chrome_switches.h" | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 103 #include "chrome/browser/metrics/jumplist_metrics_win.h" | 102 #include "chrome/browser/metrics/jumplist_metrics_win.h" | 
| 104 #include "components/search_engines/desktop_search_utils.h" | 103 #include "components/search_engines/desktop_search_utils.h" | 
| 105 #endif | 104 #endif | 
| 106 | 105 | 
| 107 #if defined(ENABLE_PRINT_PREVIEW) | 106 #if defined(ENABLE_PRINT_PREVIEW) | 
| 108 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 107 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 
| 109 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
     h" | 108 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
     h" | 
| 110 #include "chrome/browser/printing/print_dialog_cloud.h" | 109 #include "chrome/browser/printing/print_dialog_cloud.h" | 
| 111 #endif | 110 #endif | 
| 112 | 111 | 
|  | 112 #if defined(ENABLE_APP_LIST) | 
|  | 113 #include "chrome/browser/ui/app_list/app_list_service.h" | 
|  | 114 #endif | 
|  | 115 | 
| 113 using content::BrowserThread; | 116 using content::BrowserThread; | 
| 114 using content::ChildProcessSecurityPolicy; | 117 using content::ChildProcessSecurityPolicy; | 
| 115 | 118 | 
| 116 namespace { | 119 namespace { | 
| 117 | 120 | 
| 118 // Keeps track on which profiles have been launched. | 121 // Keeps track on which profiles have been launched. | 
| 119 class ProfileLaunchObserver : public content::NotificationObserver { | 122 class ProfileLaunchObserver : public content::NotificationObserver { | 
| 120  public: | 123  public: | 
| 121   ProfileLaunchObserver() | 124   ProfileLaunchObserver() | 
| 122       : profile_to_activate_(NULL), | 125       : profile_to_activate_(NULL), | 
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 865       !profile_launch_observer.Get().HasBeenLaunched(profile); | 868       !profile_launch_observer.Get().HasBeenLaunched(profile); | 
| 866 } | 869 } | 
| 867 | 870 | 
| 868 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, | 871 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, | 
| 869                                      const base::CommandLine& command_line) { | 872                                      const base::CommandLine& command_line) { | 
| 870   if (command_line.HasSwitch(switches::kProfileDirectory)) { | 873   if (command_line.HasSwitch(switches::kProfileDirectory)) { | 
| 871     return user_data_dir.Append( | 874     return user_data_dir.Append( | 
| 872         command_line.GetSwitchValuePath(switches::kProfileDirectory)); | 875         command_line.GetSwitchValuePath(switches::kProfileDirectory)); | 
| 873   } | 876   } | 
| 874 | 877 | 
|  | 878 #if defined(ENABLE_APP_LIST) | 
| 875   // If we are showing the app list then chrome isn't shown so load the app | 879   // If we are showing the app list then chrome isn't shown so load the app | 
| 876   // list's profile rather than chrome's. | 880   // list's profile rather than chrome's. | 
| 877   if (command_line.HasSwitch(switches::kShowAppList)) | 881   if (command_line.HasSwitch(switches::kShowAppList)) | 
| 878     return AppListService::Get()->GetProfilePath(user_data_dir); | 882     return AppListService::Get()->GetProfilePath(user_data_dir); | 
|  | 883 #endif | 
| 879 | 884 | 
| 880   return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 885   return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 
| 881       user_data_dir); | 886       user_data_dir); | 
| 882 } | 887 } | 
| OLD | NEW | 
|---|