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 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 } | 1499 } |
1500 | 1500 |
1501 #if defined(OS_WIN) | 1501 #if defined(OS_WIN) |
1502 // If it's the first run, log the search engine chosen. We wait until | 1502 // If it's the first run, log the search engine chosen. We wait until |
1503 // shutdown because otherwise we can't be sure the user has finished | 1503 // shutdown because otherwise we can't be sure the user has finished |
1504 // selecting a search engine through the dialog reached from the first run | 1504 // selecting a search engine through the dialog reached from the first run |
1505 // bubble link. | 1505 // bubble link. |
1506 if (FirstRun::InSearchExperimentLocale() && record_search_engine) { | 1506 if (FirstRun::InSearchExperimentLocale() && record_search_engine) { |
1507 const TemplateURL* default_search_engine = | 1507 const TemplateURL* default_search_engine = |
1508 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); | 1508 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); |
| 1509 // The default engine can be NULL if the administrator has disabled |
| 1510 // default search. |
| 1511 TemplateURLPrepopulateData::SearchEngineType search_engine_type = |
| 1512 default_search_engine ? default_search_engine->search_engine_type() : |
| 1513 TemplateURLPrepopulateData::SEARCH_ENGINE_OTHER; |
1509 // Record the search engine chosen. | 1514 // Record the search engine chosen. |
1510 if (master_prefs.run_search_engine_experiment) { | 1515 if (master_prefs.run_search_engine_experiment) { |
1511 UMA_HISTOGRAM_ENUMERATION( | 1516 UMA_HISTOGRAM_ENUMERATION( |
1512 "Chrome.SearchSelectExperiment", | 1517 "Chrome.SearchSelectExperiment", |
1513 default_search_engine->search_engine_type(), | 1518 search_engine_type, |
1514 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); | 1519 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); |
1515 // If the selection has been randomized, also record the winner by slot. | 1520 // If the selection has been randomized, also record the winner by slot. |
1516 if (master_prefs.randomize_search_engine_experiment) { | 1521 if (master_prefs.randomize_search_engine_experiment) { |
1517 size_t engine_pos = profile->GetTemplateURLModel()-> | 1522 size_t engine_pos = profile->GetTemplateURLModel()-> |
1518 GetSearchEngineDialogSlot(); | 1523 GetSearchEngineDialogSlot(); |
1519 if (engine_pos < 4) { | 1524 if (engine_pos < 4) { |
1520 std::string experiment_type = "Chrome.SearchSelectExperimentSlot"; | 1525 std::string experiment_type = "Chrome.SearchSelectExperimentSlot"; |
1521 // Nicer in UMA if slots are 1-based. | 1526 // Nicer in UMA if slots are 1-based. |
1522 experiment_type.push_back('1' + engine_pos); | 1527 experiment_type.push_back('1' + engine_pos); |
1523 UMA_HISTOGRAM_ENUMERATION( | 1528 UMA_HISTOGRAM_ENUMERATION( |
1524 experiment_type, | 1529 experiment_type, |
1525 default_search_engine->search_engine_type(), | 1530 search_engine_type, |
1526 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); | 1531 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); |
1527 } else { | 1532 } else { |
1528 NOTREACHED() << "Invalid search engine selection slot."; | 1533 NOTREACHED() << "Invalid search engine selection slot."; |
1529 } | 1534 } |
1530 } | 1535 } |
1531 } else { | 1536 } else { |
1532 UMA_HISTOGRAM_ENUMERATION( | 1537 UMA_HISTOGRAM_ENUMERATION( |
1533 "Chrome.SearchSelectExempt", | 1538 "Chrome.SearchSelectExempt", |
1534 default_search_engine->search_engine_type(), | 1539 search_engine_type, |
1535 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); | 1540 TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); |
1536 } | 1541 } |
1537 } | 1542 } |
1538 #endif | 1543 #endif |
1539 | 1544 |
1540 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Stop(); | 1545 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Stop(); |
1541 | 1546 |
1542 process_singleton.Cleanup(); | 1547 process_singleton.Cleanup(); |
1543 | 1548 |
1544 metrics->Stop(); | 1549 metrics->Stop(); |
1545 | 1550 |
1546 // browser_shutdown takes care of deleting browser_process, so we need to | 1551 // browser_shutdown takes care of deleting browser_process, so we need to |
1547 // release it. | 1552 // release it. |
1548 ignore_result(browser_process.release()); | 1553 ignore_result(browser_process.release()); |
1549 browser_shutdown::Shutdown(); | 1554 browser_shutdown::Shutdown(); |
1550 | 1555 |
1551 TRACE_EVENT_END("BrowserMain", 0, 0); | 1556 TRACE_EVENT_END("BrowserMain", 0, 0); |
1552 return result_code; | 1557 return result_code; |
1553 } | 1558 } |
OLD | NEW |