OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 #endif | 1399 #endif |
1400 | 1400 |
1401 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1401 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1402 // On Linux, the running exe will be updated if an upgrade becomes | 1402 // On Linux, the running exe will be updated if an upgrade becomes |
1403 // available while the browser is running. We need to save the last | 1403 // available while the browser is running. We need to save the last |
1404 // modified time of the exe, so we can compare to determine if there is | 1404 // modified time of the exe, so we can compare to determine if there is |
1405 // an upgrade while the browser is kept alive by a persistent extension. | 1405 // an upgrade while the browser is kept alive by a persistent extension. |
1406 Upgrade::SaveLastModifiedTimeOfExe(); | 1406 Upgrade::SaveLastModifiedTimeOfExe(); |
1407 #endif | 1407 #endif |
1408 | 1408 |
1409 // Record now as the last succesful chrome start. | 1409 // Record now as the last successful chrome start. |
1410 GoogleUpdateSettings::SetLastRunTime(); | 1410 GoogleUpdateSettings::SetLastRunTime(); |
1411 // Call Recycle() here as late as possible, before going into the loop | 1411 // Call Recycle() here as late as possible, before going into the loop |
1412 // because Start() will add things to it while creating the main window. | 1412 // because Start() will add things to it while creating the main window. |
1413 if (pool) | 1413 if (pool) |
1414 pool->Recycle(); | 1414 pool->Recycle(); |
1415 RunUIMessageLoop(browser_process.get()); | 1415 RunUIMessageLoop(browser_process.get()); |
1416 } | 1416 } |
1417 } | 1417 } |
1418 | 1418 |
1419 #if defined(OS_WIN) | 1419 #if defined(OS_WIN) |
1420 // If it's the first run, log the search engine chosen. We wait until | 1420 // If it's the first run, log the search engine chosen. We wait until |
1421 // shutdown because otherwise we can't be sure the user has finished | 1421 // shutdown because otherwise we can't be sure the user has finished |
1422 // selecting a search engine through the dialog reached from the first run | 1422 // selecting a search engine through the dialog reached from the first run |
1423 // bubble link. | 1423 // bubble link. |
1424 if (FirstRun::InSearchExperimentLocale() && record_search_engine) { | 1424 if (FirstRun::InSearchExperimentLocale() && record_search_engine) { |
1425 const TemplateURL* default_search_engine = | 1425 const TemplateURL* default_search_engine = |
1426 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); | 1426 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); |
| 1427 // Record the search engine chosen. |
1427 if (master_prefs.run_search_engine_experiment) { | 1428 if (master_prefs.run_search_engine_experiment) { |
1428 UMA_HISTOGRAM_ENUMERATION( | 1429 UMA_HISTOGRAM_ENUMERATION( |
1429 "Chrome.SearchSelectExperiment", | 1430 "Chrome.SearchSelectExperiment", |
1430 TemplateURLPrepopulateData::GetSearchEngineType( | 1431 TemplateURLPrepopulateData::GetSearchEngineType( |
| 1432 default_search_engine), |
| 1433 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); |
| 1434 // If the selection has been randomized, also record the winner by slot. |
| 1435 if (master_prefs.randomize_search_engine_experiment) { |
| 1436 size_t engine_pos = profile->GetTemplateURLModel()-> |
| 1437 GetSearchEngineDialogSlot(); |
| 1438 if (engine_pos < 4) { |
| 1439 std::string experiment_type = "Chrome.SearchSelectExperimentSlot"; |
| 1440 // Nicer in UMA if slots are 1-based. |
| 1441 experiment_type.push_back('1' + engine_pos); |
| 1442 UMA_HISTOGRAM_ENUMERATION( |
| 1443 experiment_type, |
| 1444 TemplateURLPrepopulateData::GetSearchEngineType( |
1431 default_search_engine), | 1445 default_search_engine), |
1432 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); | 1446 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); |
| 1447 } else { |
| 1448 NOTREACHED() << "Invalid search engine selection slot."; |
| 1449 } |
| 1450 } |
1433 } else { | 1451 } else { |
1434 UMA_HISTOGRAM_ENUMERATION( | 1452 UMA_HISTOGRAM_ENUMERATION( |
1435 "Chrome.SearchSelectExempt", | 1453 "Chrome.SearchSelectExempt", |
1436 TemplateURLPrepopulateData::GetSearchEngineType( | 1454 TemplateURLPrepopulateData::GetSearchEngineType( |
1437 default_search_engine), | 1455 default_search_engine), |
1438 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); | 1456 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); |
1439 } | 1457 } |
1440 } | 1458 } |
1441 #endif | 1459 #endif |
1442 | 1460 |
1443 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Stop(); | 1461 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Stop(); |
1444 | 1462 |
1445 process_singleton.Cleanup(); | 1463 process_singleton.Cleanup(); |
1446 | 1464 |
1447 metrics->Stop(); | 1465 metrics->Stop(); |
1448 | 1466 |
1449 // browser_shutdown takes care of deleting browser_process, so we need to | 1467 // browser_shutdown takes care of deleting browser_process, so we need to |
1450 // release it. | 1468 // release it. |
1451 ignore_result(browser_process.release()); | 1469 ignore_result(browser_process.release()); |
1452 browser_shutdown::Shutdown(); | 1470 browser_shutdown::Shutdown(); |
1453 | 1471 |
1454 return result_code; | 1472 return result_code; |
1455 } | 1473 } |
OLD | NEW |