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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 local_state->GetString(prefs::kApplicationLocale) != owner_locale && | 293 local_state->GetString(prefs::kApplicationLocale) != owner_locale && |
294 !local_state->IsManagedPreference(prefs::kApplicationLocale)) { | 294 !local_state->IsManagedPreference(prefs::kApplicationLocale)) { |
295 local_state->SetString(prefs::kApplicationLocale, owner_locale); | 295 local_state->SetString(prefs::kApplicationLocale, owner_locale); |
296 } | 296 } |
297 } | 297 } |
298 #endif | 298 #endif |
299 | 299 |
300 return local_state; | 300 return local_state; |
301 } | 301 } |
302 | 302 |
303 // Returns the path that contains the profile that should be loaded | |
304 // on process startup. | |
305 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, | |
306 const CommandLine& command_line) { | |
307 if (command_line.HasSwitch(switches::kProfileDirectory)) { | |
308 return user_data_dir.Append( | |
309 command_line.GetSwitchValuePath(switches::kProfileDirectory)); | |
310 } | |
311 | |
312 // If we are showing the app list then chrome isn't shown so load the app | |
313 // list's profile rather than chrome's. | |
314 if (command_line.HasSwitch(switches::kShowAppList)) { | |
315 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | |
316 GetProfilePath(user_data_dir); | |
317 } | |
318 | |
319 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | |
320 user_data_dir); | |
321 } | |
322 | |
323 // Initializes the profile, possibly doing some user prompting to pick a | 303 // Initializes the profile, possibly doing some user prompting to pick a |
324 // fallback profile. Returns the newly created profile, or NULL if startup | 304 // fallback profile. Returns the newly created profile, or NULL if startup |
325 // should not continue. | 305 // should not continue. |
326 Profile* CreateProfile(const content::MainFunctionParams& parameters, | 306 Profile* CreateProfile(const content::MainFunctionParams& parameters, |
327 const base::FilePath& user_data_dir, | 307 const base::FilePath& user_data_dir, |
328 const CommandLine& parsed_command_line) { | 308 const CommandLine& parsed_command_line) { |
329 TRACE_EVENT0("startup", "ChromeBrowserMainParts::CreateProfile") | 309 TRACE_EVENT0("startup", "ChromeBrowserMainParts::CreateProfile") |
330 base::Time start = base::Time::Now(); | 310 base::Time start = base::Time::Now(); |
331 if (profiles::IsMultipleProfilesEnabled() && | 311 if (profiles::IsMultipleProfilesEnabled() && |
332 parsed_command_line.HasSwitch(switches::kProfileDirectory)) { | 312 parsed_command_line.HasSwitch(switches::kProfileDirectory)) { |
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 chromeos::CrosSettings::Shutdown(); | 1669 chromeos::CrosSettings::Shutdown(); |
1690 #endif | 1670 #endif |
1691 #endif | 1671 #endif |
1692 } | 1672 } |
1693 | 1673 |
1694 // Public members: | 1674 // Public members: |
1695 | 1675 |
1696 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1676 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1697 chrome_extra_parts_.push_back(parts); | 1677 chrome_extra_parts_.push_back(parts); |
1698 } | 1678 } |
OLD | NEW |