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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 #include "chrome/browser/extensions/extensions_startup.h" | 42 #include "chrome/browser/extensions/extensions_startup.h" |
43 #include "chrome/browser/first_run/first_run.h" | 43 #include "chrome/browser/first_run/first_run.h" |
44 #include "chrome/browser/first_run/first_run_browser_process.h" | 44 #include "chrome/browser/first_run/first_run_browser_process.h" |
45 #include "chrome/browser/first_run/upgrade_util.h" | 45 #include "chrome/browser/first_run/upgrade_util.h" |
46 #include "chrome/browser/jankometer.h" | 46 #include "chrome/browser/jankometer.h" |
47 #include "chrome/browser/metrics/field_trial_synchronizer.h" | 47 #include "chrome/browser/metrics/field_trial_synchronizer.h" |
48 #include "chrome/browser/metrics/histogram_synchronizer.h" | 48 #include "chrome/browser/metrics/histogram_synchronizer.h" |
49 #include "chrome/browser/metrics/metrics_log.h" | 49 #include "chrome/browser/metrics/metrics_log.h" |
50 #include "chrome/browser/metrics/metrics_service.h" | 50 #include "chrome/browser/metrics/metrics_service.h" |
51 #include "chrome/browser/metrics/thread_watcher.h" | 51 #include "chrome/browser/metrics/thread_watcher.h" |
52 #include "chrome/browser/net/blob_url_request_job_factory.h" | |
52 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" | 53 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" |
53 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 54 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
55 #include "chrome/browser/net/file_system_url_request_job_factory.h" | |
56 #include "chrome/browser/net/metadata_url_request.h" | |
54 #include "chrome/browser/net/predictor_api.h" | 57 #include "chrome/browser/net/predictor_api.h" |
55 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 58 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
56 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" | 59 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" |
57 #include "chrome/browser/plugin_updater.h" | 60 #include "chrome/browser/plugin_updater.h" |
58 #include "chrome/browser/prefs/pref_service.h" | 61 #include "chrome/browser/prefs/pref_service.h" |
59 #include "chrome/browser/prefs/pref_value_store.h" | 62 #include "chrome/browser/prefs/pref_value_store.h" |
60 #include "chrome/browser/prerender/prerender_field_trial.h" | 63 #include "chrome/browser/prerender/prerender_field_trial.h" |
61 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 64 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
62 #include "chrome/browser/process_singleton.h" | 65 #include "chrome/browser/process_singleton.h" |
63 #include "chrome/browser/profiles/profile.h" | 66 #include "chrome/browser/profiles/profile.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 #include "chrome/browser/chromeos/cros/cros_library.h" | 138 #include "chrome/browser/chromeos/cros/cros_library.h" |
136 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 139 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
137 #include "chrome/browser/chromeos/customization_document.h" | 140 #include "chrome/browser/chromeos/customization_document.h" |
138 #include "chrome/browser/chromeos/external_metrics.h" | 141 #include "chrome/browser/chromeos/external_metrics.h" |
139 #include "chrome/browser/chromeos/login/authenticator.h" | 142 #include "chrome/browser/chromeos/login/authenticator.h" |
140 #include "chrome/browser/chromeos/login/login_utils.h" | 143 #include "chrome/browser/chromeos/login/login_utils.h" |
141 #include "chrome/browser/chromeos/login/ownership_service.h" | 144 #include "chrome/browser/chromeos/login/ownership_service.h" |
142 #include "chrome/browser/chromeos/login/screen_locker.h" | 145 #include "chrome/browser/chromeos/login/screen_locker.h" |
143 #include "chrome/browser/chromeos/login/user_manager.h" | 146 #include "chrome/browser/chromeos/login/user_manager.h" |
144 #include "chrome/browser/chromeos/metrics_cros_settings_provider.h" | 147 #include "chrome/browser/chromeos/metrics_cros_settings_provider.h" |
148 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" | |
145 #include "chrome/browser/chromeos/system_key_event_listener.h" | 149 #include "chrome/browser/chromeos/system_key_event_listener.h" |
146 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" | 150 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" |
147 #include "chrome/browser/oom_priority_manager.h" | 151 #include "chrome/browser/oom_priority_manager.h" |
148 #include "chrome/browser/ui/views/browser_dialogs.h" | 152 #include "chrome/browser/ui/views/browser_dialogs.h" |
149 #endif | 153 #endif |
150 | 154 |
151 // TODO(port): several win-only methods have been pulled out of this, but | 155 // TODO(port): several win-only methods have been pulled out of this, but |
152 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 156 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
153 // other platforms. For now, it's just a stub. This is a serious work in | 157 // other platforms. For now, it's just a stub. This is a serious work in |
154 // progress and should not be taken as an indication of a real refactoring. | 158 // progress and should not be taken as an indication of a real refactoring. |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- | 526 // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- |
523 | 527 |
524 void BrowserMainParts::MainMessageLoopStart() { | 528 void BrowserMainParts::MainMessageLoopStart() { |
525 PreMainMessageLoopStart(); | 529 PreMainMessageLoopStart(); |
526 | 530 |
527 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 531 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
528 | 532 |
529 // TODO(viettrungluu): should these really go before setting the thread name? | 533 // TODO(viettrungluu): should these really go before setting the thread name? |
530 system_monitor_.reset(new ui::SystemMonitor); | 534 system_monitor_.reset(new ui::SystemMonitor); |
531 hi_res_timer_manager_.reset(new HighResolutionTimerManager); | 535 hi_res_timer_manager_.reset(new HighResolutionTimerManager); |
536 #if defined(OS_CHROMEOS) | |
oshima
2011/05/18 01:28:45
this looks wrong?
zel
2011/05/18 01:34:00
Yes, pressed ctrl+z too many times here. Done.
| |
532 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 537 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
533 | 538 #else |
539 // TODO(zelidrag): We need to move cros library glue code outside of | |
540 // chrome/browser directory to avoid check_deps issues and then migrate | |
541 // NetworkChangeNotifierCros class to net/base where other OS implementations | |
542 // live. | |
543 network_change_notifier_.reset(new chromeos::NetworkChangeNotifierChromeos()); | |
544 #endif | |
534 InitializeMainThread(); | 545 InitializeMainThread(); |
535 | 546 |
536 PostMainMessageLoopStart(); | 547 PostMainMessageLoopStart(); |
537 Profiling::MainMessageLoopStarted(); | 548 Profiling::MainMessageLoopStarted(); |
538 } | 549 } |
539 | 550 |
540 void BrowserMainParts::InitializeMainThread() { | 551 void BrowserMainParts::InitializeMainThread() { |
541 const char* kThreadName = "CrBrowserMain"; | 552 const char* kThreadName = "CrBrowserMain"; |
542 base::PlatformThread::SetName(kThreadName); | 553 base::PlatformThread::SetName(kThreadName); |
543 main_message_loop().set_thread_name(kThreadName); | 554 main_message_loop().set_thread_name(kThreadName); |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1680 // Init the RLZ library. This just binds the dll and schedules a task on the | 1691 // Init the RLZ library. This just binds the dll and schedules a task on the |
1681 // file thread to be run sometime later. If this is the first run we record | 1692 // file thread to be run sometime later. If this is the first run we record |
1682 // the installation event. | 1693 // the installation event. |
1683 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay); | 1694 RLZTracker::InitRlzDelayed(is_first_run, master_prefs.ping_delay); |
1684 #endif // GOOGLE_CHROME_BUILD | 1695 #endif // GOOGLE_CHROME_BUILD |
1685 #endif // OS_WIN | 1696 #endif // OS_WIN |
1686 | 1697 |
1687 // Configure modules that need access to resources. | 1698 // Configure modules that need access to resources. |
1688 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 1699 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
1689 | 1700 |
1701 // Register our global network handler for chrome:// and | |
1702 // chrome-extension:// URLs. | |
1703 ChromeURLDataManagerBackend::Register(); | |
1704 RegisterExtensionProtocols(); | |
1705 RegisterMetadataURLRequestHandler(); | |
1706 RegisterBlobURLRequestJobFactory(); | |
1707 RegisterFileSystemURLRequestJobFactory(); | |
oshima
2011/05/18 01:28:45
These wasn't here before. Is this intentional?
The
zel
2011/05/18 01:34:00
Hmm. I have no idea where that comes from. Let me
| |
1708 | |
1690 // In unittest mode, this will do nothing. In normal mode, this will create | 1709 // In unittest mode, this will do nothing. In normal mode, this will create |
1691 // the global GoogleURLTracker and IntranetRedirectDetector instances, which | 1710 // the global GoogleURLTracker and IntranetRedirectDetector instances, which |
1692 // will promptly go to sleep for five and seven seconds, respectively (to | 1711 // will promptly go to sleep for five and seven seconds, respectively (to |
1693 // avoid slowing startup), and wake up afterwards to see if they should do | 1712 // avoid slowing startup), and wake up afterwards to see if they should do |
1694 // anything else. | 1713 // anything else. |
1695 // | 1714 // |
1696 // A simpler way of doing all this would be to have some function which could | 1715 // A simpler way of doing all this would be to have some function which could |
1697 // give the time elapsed since startup, and simply have these objects check | 1716 // give the time elapsed since startup, and simply have these objects check |
1698 // that when asked to initialize themselves, but this doesn't seem to exist. | 1717 // that when asked to initialize themselves, but this doesn't seem to exist. |
1699 // | 1718 // |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1941 #if defined(OS_CHROMEOS) | 1960 #if defined(OS_CHROMEOS) |
1942 // To be precise, logout (browser shutdown) is not yet done, but the | 1961 // To be precise, logout (browser shutdown) is not yet done, but the |
1943 // remaining work is negligible, hence we say LogoutDone here. | 1962 // remaining work is negligible, hence we say LogoutDone here. |
1944 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1963 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1945 false); | 1964 false); |
1946 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1965 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1947 #endif | 1966 #endif |
1948 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 1967 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
1949 return result_code; | 1968 return result_code; |
1950 } | 1969 } |
OLD | NEW |