OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 user_data_dir); | 442 user_data_dir); |
443 } else { | 443 } else { |
444 profile = g_browser_process->profile_manager()->GetDefaultProfile( | 444 profile = g_browser_process->profile_manager()->GetDefaultProfile( |
445 user_data_dir); | 445 user_data_dir); |
446 } | 446 } |
447 | 447 |
448 if (profile) | 448 if (profile) |
449 return profile; | 449 return profile; |
450 | 450 |
451 #if defined(OS_WIN) | 451 #if defined(OS_WIN) |
| 452 #if defined(USE_AURA) |
| 453 // TODO(beng): |
| 454 NOTIMPLEMENTED(); |
| 455 #else |
452 // Ideally, we should be able to run w/o access to disk. For now, we | 456 // Ideally, we should be able to run w/o access to disk. For now, we |
453 // prompt the user to pick a different user-data-dir and restart chrome | 457 // prompt the user to pick a different user-data-dir and restart chrome |
454 // with the new dir. | 458 // with the new dir. |
455 // http://code.google.com/p/chromium/issues/detail?id=11510 | 459 // http://code.google.com/p/chromium/issues/detail?id=11510 |
456 FilePath new_user_data_dir = UserDataDirDialog::RunUserDataDirDialog( | 460 FilePath new_user_data_dir = UserDataDirDialog::RunUserDataDirDialog( |
457 user_data_dir); | 461 user_data_dir); |
458 if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) { | 462 if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) { |
459 // Only delete the resources if we're not running tests. If we're running | 463 // Only delete the resources if we're not running tests. If we're running |
460 // tests the resources need to be reused as many places in the UI cache | 464 // tests the resources need to be reused as many places in the UI cache |
461 // SkBitmaps from the ResourceBundle. | 465 // SkBitmaps from the ResourceBundle. |
462 ResourceBundle::CleanupSharedInstance(); | 466 ResourceBundle::CleanupSharedInstance(); |
463 } | 467 } |
464 | 468 |
465 if (!new_user_data_dir.empty()) { | 469 if (!new_user_data_dir.empty()) { |
466 // Because of the way CommandLine parses, it's sufficient to append a new | 470 // Because of the way CommandLine parses, it's sufficient to append a new |
467 // --user-data-dir switch. The last flag of the same name wins. | 471 // --user-data-dir switch. The last flag of the same name wins. |
468 // TODO(tc): It would be nice to remove the flag we don't want, but that | 472 // TODO(tc): It would be nice to remove the flag we don't want, but that |
469 // sounds risky if we parse differently than CommandLineToArgvW. | 473 // sounds risky if we parse differently than CommandLineToArgvW. |
470 CommandLine new_command_line = parameters.command_line_; | 474 CommandLine new_command_line = parameters.command_line_; |
471 new_command_line.AppendSwitchPath(switches::kUserDataDir, | 475 new_command_line.AppendSwitchPath(switches::kUserDataDir, |
472 new_user_data_dir); | 476 new_user_data_dir); |
473 base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL); | 477 base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL); |
474 } | 478 } |
| 479 #endif |
475 #else | 480 #else |
476 // TODO(port): fix this. See comments near the definition of | 481 // TODO(port): fix this. See comments near the definition of |
477 // user_data_dir. It is better to CHECK-fail here than it is to | 482 // user_data_dir. It is better to CHECK-fail here than it is to |
478 // silently exit because of missing code in the above test. | 483 // silently exit because of missing code in the above test. |
479 CHECK(profile) << "Cannot get default profile."; | 484 CHECK(profile) << "Cannot get default profile."; |
480 #endif | 485 #endif |
481 | 486 |
482 return NULL; | 487 return NULL; |
483 } | 488 } |
484 | 489 |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 #endif // defined(OS_MACOSX) | 1206 #endif // defined(OS_MACOSX) |
1202 } | 1207 } |
1203 | 1208 |
1204 #if defined(TOOLKIT_GTK) | 1209 #if defined(TOOLKIT_GTK) |
1205 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); | 1210 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); |
1206 #endif | 1211 #endif |
1207 | 1212 |
1208 std::string try_chrome = | 1213 std::string try_chrome = |
1209 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); | 1214 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); |
1210 if (!try_chrome.empty()) { | 1215 if (!try_chrome.empty()) { |
1211 #if defined(OS_WIN) | 1216 #if defined(OS_WIN) && !defined(USE_AURA) |
1212 // Setup.exe has determined that we need to run a retention experiment | 1217 // Setup.exe has determined that we need to run a retention experiment |
1213 // and has lauched chrome to show the experiment UI. | 1218 // and has lauched chrome to show the experiment UI. |
1214 if (process_singleton.FoundOtherProcessWindow()) { | 1219 if (process_singleton.FoundOtherProcessWindow()) { |
1215 // It seems that we don't need to run the experiment since chrome | 1220 // It seems that we don't need to run the experiment since chrome |
1216 // in the same profile is already running. | 1221 // in the same profile is already running. |
1217 VLOG(1) << "Retention experiment not required"; | 1222 VLOG(1) << "Retention experiment not required"; |
1218 return TryChromeDialogView::NOT_NOW; | 1223 return TryChromeDialogView::NOT_NOW; |
1219 } | 1224 } |
1220 int try_chrome_int; | 1225 int try_chrome_int; |
1221 base::StringToInt(try_chrome, &try_chrome_int); | 1226 base::StringToInt(try_chrome, &try_chrome_int); |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 1941 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
1937 (pre_read == "0" || pre_read == "1")) { | 1942 (pre_read == "0" || pre_read == "1")) { |
1938 std::string uma_name(name); | 1943 std::string uma_name(name); |
1939 uma_name += "_PreRead"; | 1944 uma_name += "_PreRead"; |
1940 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 1945 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
1941 AddPreReadHistogramTime(uma_name.c_str(), time); | 1946 AddPreReadHistogramTime(uma_name.c_str(), time); |
1942 } | 1947 } |
1943 #endif | 1948 #endif |
1944 #endif | 1949 #endif |
1945 } | 1950 } |
OLD | NEW |