| 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 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "chrome/browser/metrics/histogram_synchronizer.h" | 52 #include "chrome/browser/metrics/histogram_synchronizer.h" |
| 53 #include "chrome/browser/metrics/metrics_log.h" | 53 #include "chrome/browser/metrics/metrics_log.h" |
| 54 #include "chrome/browser/metrics/metrics_service.h" | 54 #include "chrome/browser/metrics/metrics_service.h" |
| 55 #include "chrome/browser/metrics/thread_watcher.h" | 55 #include "chrome/browser/metrics/thread_watcher.h" |
| 56 #include "chrome/browser/metrics/tracking_synchronizer.h" | 56 #include "chrome/browser/metrics/tracking_synchronizer.h" |
| 57 #include "chrome/browser/metrics/variations_service.h" | 57 #include "chrome/browser/metrics/variations_service.h" |
| 58 #include "chrome/browser/nacl_host/nacl_process_host.h" | 58 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 59 #include "chrome/browser/net/chrome_net_log.h" | 59 #include "chrome/browser/net/chrome_net_log.h" |
| 60 #include "chrome/browser/net/predictor.h" | 60 #include "chrome/browser/net/predictor.h" |
| 61 #include "chrome/browser/notifications/desktop_notification_service.h" | 61 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 62 #include "chrome/browser/page_cycler/page_cycler.h" |
| 62 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 63 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 63 #include "chrome/browser/plugin_prefs.h" | 64 #include "chrome/browser/plugin_prefs.h" |
| 64 #include "chrome/browser/prefs/pref_service.h" | 65 #include "chrome/browser/prefs/pref_service.h" |
| 65 #include "chrome/browser/prefs/pref_value_store.h" | 66 #include "chrome/browser/prefs/pref_value_store.h" |
| 66 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 67 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 67 #include "chrome/browser/prerender/prerender_field_trial.h" | 68 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 68 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 69 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 69 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 70 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 70 #include "chrome/browser/process_singleton.h" | 71 #include "chrome/browser/process_singleton.h" |
| 71 #include "chrome/browser/profiles/profile.h" | 72 #include "chrome/browser/profiles/profile.h" |
| 72 #include "chrome/browser/profiles/profile_manager.h" | 73 #include "chrome/browser/profiles/profile_manager.h" |
| 73 #include "chrome/browser/search_engines/search_engine_type.h" | 74 #include "chrome/browser/search_engines/search_engine_type.h" |
| 74 #include "chrome/browser/search_engines/template_url.h" | 75 #include "chrome/browser/search_engines/template_url.h" |
| 75 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 76 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 76 #include "chrome/browser/search_engines/template_url_service.h" | 77 #include "chrome/browser/search_engines/template_url_service.h" |
| 77 #include "chrome/browser/search_engines/template_url_service_factory.h" | 78 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 78 #include "chrome/browser/service/service_process_control.h" | 79 #include "chrome/browser/service/service_process_control.h" |
| 79 #include "chrome/browser/shell_integration.h" | 80 #include "chrome/browser/shell_integration.h" |
| 80 #include "chrome/browser/translate/translate_manager.h" | 81 #include "chrome/browser/translate/translate_manager.h" |
| 81 #include "chrome/browser/ui/browser.h" | 82 #include "chrome/browser/ui/browser.h" |
| 83 #include "chrome/browser/ui/browser_finder.h" |
| 82 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 84 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 83 #include "chrome/browser/ui/user_data_dir_dialog.h" | 85 #include "chrome/browser/ui/user_data_dir_dialog.h" |
| 84 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 86 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| 85 #include "chrome/common/child_process_logging.h" | 87 #include "chrome/common/child_process_logging.h" |
| 86 #include "chrome/common/chrome_constants.h" | 88 #include "chrome/common/chrome_constants.h" |
| 87 #include "chrome/common/chrome_paths.h" | 89 #include "chrome/common/chrome_paths.h" |
| 88 #include "chrome/common/chrome_result_codes.h" | 90 #include "chrome/common/chrome_result_codes.h" |
| 89 #include "chrome/common/chrome_switches.h" | 91 #include "chrome/common/chrome_switches.h" |
| 90 #include "chrome/common/chrome_version_info.h" | 92 #include "chrome/common/chrome_version_info.h" |
| 91 #include "chrome/common/env_vars.h" | 93 #include "chrome/common/env_vars.h" |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1436 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1435 chrome_extra_parts_[i]->PostProfileInit(); | 1437 chrome_extra_parts_[i]->PostProfileInit(); |
| 1436 } | 1438 } |
| 1437 | 1439 |
| 1438 void ChromeBrowserMainParts::PreBrowserStart() { | 1440 void ChromeBrowserMainParts::PreBrowserStart() { |
| 1439 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1441 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1440 chrome_extra_parts_[i]->PreBrowserStart(); | 1442 chrome_extra_parts_[i]->PreBrowserStart(); |
| 1441 } | 1443 } |
| 1442 | 1444 |
| 1443 void ChromeBrowserMainParts::PostBrowserStart() { | 1445 void ChromeBrowserMainParts::PostBrowserStart() { |
| 1446 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVisitURLs)) |
| 1447 RunPageCycler(); |
| 1448 |
| 1444 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1449 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1445 chrome_extra_parts_[i]->PostBrowserStart(); | 1450 chrome_extra_parts_[i]->PostBrowserStart(); |
| 1446 // Allow ProcessSingleton to process messages. | 1451 // Allow ProcessSingleton to process messages. |
| 1447 process_singleton_->Unlock(); | 1452 process_singleton_->Unlock(); |
| 1448 } | 1453 } |
| 1449 | 1454 |
| 1455 void ChromeBrowserMainParts::RunPageCycler() { |
| 1456 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1457 Browser* browser = browser::FindBrowserWithProfile(profile_); |
| 1458 DCHECK(browser); |
| 1459 PageCycler* page_cycler = NULL; |
| 1460 FilePath input_file = |
| 1461 command_line->GetSwitchValuePath(switches::kVisitURLs); |
| 1462 page_cycler = new PageCycler(browser, input_file); |
| 1463 page_cycler->set_errors_file( |
| 1464 input_file.AddExtension(FILE_PATH_LITERAL(".errors"))); |
| 1465 if (command_line->HasSwitch(switches::kRecordStats)) { |
| 1466 page_cycler->set_stats_file( |
| 1467 command_line->GetSwitchValuePath(switches::kRecordStats)); |
| 1468 } |
| 1469 int iterations = 1; |
| 1470 if (command_line->HasSwitch(switches::kVisitURLsCount)) { |
| 1471 CHECK(base::StringToInt( |
| 1472 command_line->GetSwitchValueNative(switches::kVisitURLsCount), |
| 1473 &iterations)); |
| 1474 } |
| 1475 page_cycler->Run(iterations); |
| 1476 } |
| 1477 |
| 1450 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { | 1478 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
| 1451 // Now that the file thread has been started, start recording. | 1479 // Now that the file thread has been started, start recording. |
| 1452 StartMetricsRecording(); | 1480 StartMetricsRecording(); |
| 1453 | 1481 |
| 1454 // Create watchdog thread after creating all other threads because it will | 1482 // Create watchdog thread after creating all other threads because it will |
| 1455 // watch the other threads and they must be running. | 1483 // watch the other threads and they must be running. |
| 1456 browser_process_->watchdog_thread(); | 1484 browser_process_->watchdog_thread(); |
| 1457 | 1485 |
| 1458 // Do any initializating in the browser process that requires all threads | 1486 // Do any initializating in the browser process that requires all threads |
| 1459 // running. | 1487 // running. |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2035 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 2008 uma_name += "_XP"; | 2036 uma_name += "_XP"; |
| 2009 | 2037 |
| 2010 uma_name += "_PreRead_"; | 2038 uma_name += "_PreRead_"; |
| 2011 uma_name += pre_read_percentage; | 2039 uma_name += pre_read_percentage; |
| 2012 AddPreReadHistogramTime(uma_name.c_str(), time); | 2040 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2013 } | 2041 } |
| 2014 #endif | 2042 #endif |
| 2015 #endif | 2043 #endif |
| 2016 } | 2044 } |
| OLD | NEW |