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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 user_data_dir); | 322 user_data_dir); |
323 } | 323 } |
324 | 324 |
325 // Initializes the profile, possibly doing some user prompting to pick a | 325 // Initializes the profile, possibly doing some user prompting to pick a |
326 // fallback profile. Returns the newly created profile, or NULL if startup | 326 // fallback profile. Returns the newly created profile, or NULL if startup |
327 // should not continue. | 327 // should not continue. |
328 Profile* CreateProfile(const content::MainFunctionParams& parameters, | 328 Profile* CreateProfile(const content::MainFunctionParams& parameters, |
329 const base::FilePath& user_data_dir, | 329 const base::FilePath& user_data_dir, |
330 const CommandLine& parsed_command_line) { | 330 const CommandLine& parsed_command_line) { |
331 TRACE_EVENT0("startup", "ChromeBrowserMainParts::CreateProfile") | 331 TRACE_EVENT0("startup", "ChromeBrowserMainParts::CreateProfile") |
| 332 base::Time start = base::Time::Now(); |
332 if (profiles::IsMultipleProfilesEnabled() && | 333 if (profiles::IsMultipleProfilesEnabled() && |
333 parsed_command_line.HasSwitch(switches::kProfileDirectory)) { | 334 parsed_command_line.HasSwitch(switches::kProfileDirectory)) { |
334 g_browser_process->local_state()->SetString(prefs::kProfileLastUsed, | 335 g_browser_process->local_state()->SetString(prefs::kProfileLastUsed, |
335 parsed_command_line.GetSwitchValueASCII(switches::kProfileDirectory)); | 336 parsed_command_line.GetSwitchValueASCII(switches::kProfileDirectory)); |
336 // Clear kProfilesLastActive since the user only wants to launch a specific | 337 // Clear kProfilesLastActive since the user only wants to launch a specific |
337 // profile. | 338 // profile. |
338 ListPrefUpdate update(g_browser_process->local_state(), | 339 ListPrefUpdate update(g_browser_process->local_state(), |
339 prefs::kProfilesLastActive); | 340 prefs::kProfilesLastActive); |
340 ListValue* profile_list = update.Get(); | 341 ListValue* profile_list = update.Get(); |
341 profile_list->Clear(); | 342 profile_list->Clear(); |
342 } | 343 } |
343 | 344 |
344 Profile* profile = NULL; | 345 Profile* profile = NULL; |
345 #if defined(OS_CHROMEOS) | 346 #if defined(OS_CHROMEOS) |
346 // TODO(ivankr): http://crbug.com/83792 | 347 // TODO(ivankr): http://crbug.com/83792 |
347 profile = g_browser_process->profile_manager()->GetDefaultProfile( | 348 profile = g_browser_process->profile_manager()->GetDefaultProfile( |
348 user_data_dir); | 349 user_data_dir); |
349 #else | 350 #else |
350 base::FilePath profile_path = | 351 base::FilePath profile_path = |
351 GetStartupProfilePath(user_data_dir, parsed_command_line); | 352 GetStartupProfilePath(user_data_dir, parsed_command_line); |
352 profile = g_browser_process->profile_manager()->GetProfile( | 353 profile = g_browser_process->profile_manager()->GetProfile( |
353 profile_path); | 354 profile_path); |
354 #endif | 355 #endif |
355 if (profile) | 356 if (profile) { |
| 357 UMA_HISTOGRAM_LONG_TIMES( |
| 358 "Startup.CreateFirstProfile", base::Time::Now() - start); |
356 return profile; | 359 return profile; |
| 360 } |
357 | 361 |
358 #if !defined(OS_WIN) | 362 #if !defined(OS_WIN) |
359 // TODO(port): fix this. See comments near the definition of | 363 // TODO(port): fix this. See comments near the definition of |
360 // user_data_dir. It is better to CHECK-fail here than it is to | 364 // user_data_dir. It is better to CHECK-fail here than it is to |
361 // silently exit because of missing code in the above test. | 365 // silently exit because of missing code in the above test. |
362 CHECK(profile) << "Cannot get default profile."; | 366 CHECK(profile) << "Cannot get default profile."; |
363 #endif | 367 #endif |
364 | 368 |
365 return NULL; | 369 return NULL; |
366 } | 370 } |
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 chromeos::CrosSettings::Shutdown(); | 1697 chromeos::CrosSettings::Shutdown(); |
1694 #endif | 1698 #endif |
1695 #endif | 1699 #endif |
1696 } | 1700 } |
1697 | 1701 |
1698 // Public members: | 1702 // Public members: |
1699 | 1703 |
1700 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1704 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1701 chrome_extra_parts_.push_back(parts); | 1705 chrome_extra_parts_.push_back(parts); |
1702 } | 1706 } |
OLD | NEW |