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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1438 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1437 chrome_extra_parts_[i]->PostProfileInit(); | 1439 chrome_extra_parts_[i]->PostProfileInit(); |
1438 } | 1440 } |
1439 | 1441 |
1440 void ChromeBrowserMainParts::PreBrowserStart() { | 1442 void ChromeBrowserMainParts::PreBrowserStart() { |
1441 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1443 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1442 chrome_extra_parts_[i]->PreBrowserStart(); | 1444 chrome_extra_parts_[i]->PreBrowserStart(); |
1443 } | 1445 } |
1444 | 1446 |
1445 void ChromeBrowserMainParts::PostBrowserStart() { | 1447 void ChromeBrowserMainParts::PostBrowserStart() { |
| 1448 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVisitURLs)) |
| 1449 RunPageCycler(); |
| 1450 |
1446 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1451 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1447 chrome_extra_parts_[i]->PostBrowserStart(); | 1452 chrome_extra_parts_[i]->PostBrowserStart(); |
1448 // Allow ProcessSingleton to process messages. | 1453 // Allow ProcessSingleton to process messages. |
1449 process_singleton_->Unlock(); | 1454 process_singleton_->Unlock(); |
1450 } | 1455 } |
1451 | 1456 |
| 1457 void ChromeBrowserMainParts::RunPageCycler() { |
| 1458 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1459 Browser* browser = browser::FindBrowserWithProfile(profile_); |
| 1460 DCHECK(browser); |
| 1461 PageCycler* page_cycler = NULL; |
| 1462 FilePath input_file = |
| 1463 command_line->GetSwitchValuePath(switches::kVisitURLs); |
| 1464 page_cycler = new PageCycler(browser, input_file); |
| 1465 page_cycler->set_errors_file( |
| 1466 input_file.AddExtension(FILE_PATH_LITERAL(".errors"))); |
| 1467 if (command_line->HasSwitch(switches::kRecordStats)) { |
| 1468 page_cycler->set_stats_file( |
| 1469 command_line->GetSwitchValuePath(switches::kRecordStats)); |
| 1470 } |
| 1471 int iterations = 1; |
| 1472 if (command_line->HasSwitch(switches::kVisitURLsCount)) { |
| 1473 CHECK(base::StringToInt( |
| 1474 command_line->GetSwitchValueNative(switches::kVisitURLsCount), |
| 1475 &iterations)); |
| 1476 } |
| 1477 page_cycler->Run(iterations); |
| 1478 } |
| 1479 |
1452 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { | 1480 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
1453 // Now that the file thread has been started, start recording. | 1481 // Now that the file thread has been started, start recording. |
1454 StartMetricsRecording(); | 1482 StartMetricsRecording(); |
1455 | 1483 |
1456 // Create watchdog thread after creating all other threads because it will | 1484 // Create watchdog thread after creating all other threads because it will |
1457 // watch the other threads and they must be running. | 1485 // watch the other threads and they must be running. |
1458 browser_process_->watchdog_thread(); | 1486 browser_process_->watchdog_thread(); |
1459 | 1487 |
1460 // Do any initializating in the browser process that requires all threads | 1488 // Do any initializating in the browser process that requires all threads |
1461 // running. | 1489 // running. |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2033 if (base::win::GetVersion() <= base::win::VERSION_XP) |
2006 uma_name += "_XP"; | 2034 uma_name += "_XP"; |
2007 | 2035 |
2008 uma_name += "_PreRead_"; | 2036 uma_name += "_PreRead_"; |
2009 uma_name += pre_read_percentage; | 2037 uma_name += pre_read_percentage; |
2010 AddPreReadHistogramTime(uma_name.c_str(), time); | 2038 AddPreReadHistogramTime(uma_name.c_str(), time); |
2011 } | 2039 } |
2012 #endif | 2040 #endif |
2013 #endif | 2041 #endif |
2014 } | 2042 } |
OLD | NEW |