| 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 | 8 |
| 9 #include "app/hi_res_timer_manager.h" | 9 #include "app/hi_res_timer_manager.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
| 59 #include "chrome/common/pref_service.h" | 59 #include "chrome/common/pref_service.h" |
| 60 #include "chrome/common/result_codes.h" | 60 #include "chrome/common/result_codes.h" |
| 61 #include "chrome/installer/util/google_update_settings.h" | 61 #include "chrome/installer/util/google_update_settings.h" |
| 62 #include "chrome/installer/util/master_preferences.h" | 62 #include "chrome/installer/util/master_preferences.h" |
| 63 #include "grit/chromium_strings.h" | 63 #include "grit/chromium_strings.h" |
| 64 #include "grit/generated_resources.h" | 64 #include "grit/generated_resources.h" |
| 65 #include "net/base/cookie_monster.h" | 65 #include "net/base/cookie_monster.h" |
| 66 #include "net/base/net_module.h" | 66 #include "net/base/net_module.h" |
| 67 #include "net/http/http_network_session.h" | 67 #include "net/http/http_network_session.h" |
| 68 #include "net/socket/client_socket_factory.h" | |
| 69 #include "net/socket/client_socket_pool_base.h" | 68 #include "net/socket/client_socket_pool_base.h" |
| 70 | 69 |
| 71 #if defined(OS_POSIX) | 70 #if defined(OS_POSIX) |
| 72 // TODO(port): get rid of this include. It's used just to provide declarations | 71 // TODO(port): get rid of this include. It's used just to provide declarations |
| 73 // and stub definitions for classes we encouter during the porting effort. | 72 // and stub definitions for classes we encouter during the porting effort. |
| 74 #include <errno.h> | 73 #include <errno.h> |
| 75 #include <signal.h> | 74 #include <signal.h> |
| 76 #include <sys/resource.h> | 75 #include <sys/resource.h> |
| 77 #include "base/eintr_wrapper.h" | 76 #include "base/eintr_wrapper.h" |
| 78 #endif | 77 #endif |
| (...skipping 11 matching lines...) Expand all Loading... |
| 90 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 89 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
| 91 // other platforms. For now, it's just a stub. This is a serious work in | 90 // other platforms. For now, it's just a stub. This is a serious work in |
| 92 // progress and should not be taken as an indication of a real refactoring. | 91 // progress and should not be taken as an indication of a real refactoring. |
| 93 | 92 |
| 94 #if defined(OS_WIN) | 93 #if defined(OS_WIN) |
| 95 #include <windows.h> | 94 #include <windows.h> |
| 96 #include <commctrl.h> | 95 #include <commctrl.h> |
| 97 #include <shellapi.h> | 96 #include <shellapi.h> |
| 98 | 97 |
| 99 #include "app/win_util.h" | 98 #include "app/win_util.h" |
| 99 #include "base/nss_util.h" |
| 100 #include "base/registry.h" | 100 #include "base/registry.h" |
| 101 #include "base/win_util.h" | 101 #include "base/win_util.h" |
| 102 #include "chrome/browser/browser.h" | 102 #include "chrome/browser/browser.h" |
| 103 #include "chrome/browser/browser_trial.h" | 103 #include "chrome/browser/browser_trial.h" |
| 104 #include "chrome/browser/metrics/user_metrics.h" | 104 #include "chrome/browser/metrics/user_metrics.h" |
| 105 #include "chrome/browser/net/url_fixer_upper.h" | 105 #include "chrome/browser/net/url_fixer_upper.h" |
| 106 #include "chrome/browser/profile.h" | 106 #include "chrome/browser/profile.h" |
| 107 #include "chrome/browser/rlz/rlz.h" | 107 #include "chrome/browser/rlz/rlz.h" |
| 108 #include "chrome/browser/views/user_data_dir_dialog.h" | 108 #include "chrome/browser/views/user_data_dir_dialog.h" |
| 109 #include "chrome/common/env_vars.h" | 109 #include "chrome/common/env_vars.h" |
| 110 #include "chrome/installer/util/helper.h" | 110 #include "chrome/installer/util/helper.h" |
| 111 #include "chrome/installer/util/install_util.h" | 111 #include "chrome/installer/util/install_util.h" |
| 112 #include "chrome/installer/util/shell_util.h" | 112 #include "chrome/installer/util/shell_util.h" |
| 113 #include "chrome/installer/util/version.h" | 113 #include "chrome/installer/util/version.h" |
| 114 #include "net/base/net_util.h" | 114 #include "net/base/net_util.h" |
| 115 #include "net/base/sdch_manager.h" | 115 #include "net/base/sdch_manager.h" |
| 116 #include "net/base/winsock_init.h" | 116 #include "net/base/winsock_init.h" |
| 117 #include "net/http/http_network_layer.h" | 117 #include "net/socket/ssl_client_socket_nss_factory.h" |
| 118 #include "printing/printed_document.h" | 118 #include "printing/printed_document.h" |
| 119 #include "sandbox/src/sandbox.h" | 119 #include "sandbox/src/sandbox.h" |
| 120 #endif // defined(OS_WIN) | 120 #endif // defined(OS_WIN) |
| 121 | 121 |
| 122 #if defined(TOOLKIT_VIEWS) | 122 #if defined(TOOLKIT_VIEWS) |
| 123 #include "chrome/browser/views/chrome_views_delegate.h" | 123 #include "chrome/browser/views/chrome_views_delegate.h" |
| 124 #include "views/focus/accelerator_handler.h" | 124 #include "views/focus/accelerator_handler.h" |
| 125 #endif | 125 #endif |
| 126 | 126 |
| 127 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if (fd_limit > 0) { | 390 if (fd_limit > 0) { |
| 391 SetFileDescriptorLimit(fd_limit); | 391 SetFileDescriptorLimit(fd_limit); |
| 392 } | 392 } |
| 393 #endif // OS_POSIX | 393 #endif // OS_POSIX |
| 394 | 394 |
| 395 #if defined(OS_WIN) | 395 #if defined(OS_WIN) |
| 396 // Initialize Winsock. | 396 // Initialize Winsock. |
| 397 net::EnsureWinsockInit(); | 397 net::EnsureWinsockInit(); |
| 398 #endif // defined(OS_WIN) | 398 #endif // defined(OS_WIN) |
| 399 | 399 |
| 400 #if defined(OS_WIN) |
| 401 if (parsed_command_line.HasSwitch(switches::kUseNSSForSSL) || |
| 402 parsed_command_line.HasSwitch(switches::kUseSpdy)) { |
| 403 net::ClientSocketFactory::SetSSLClientSocketFactory( |
| 404 net::SSLClientSocketNSSFactory); |
| 405 // We want to be sure to init NSPR on the main thread. |
| 406 base::EnsureNSPRInit(); |
| 407 } |
| 408 #endif |
| 409 |
| 400 // Do platform-specific things (such as finishing initializing Cocoa) | 410 // Do platform-specific things (such as finishing initializing Cocoa) |
| 401 // prior to instantiating the message loop. This could be turned into a | 411 // prior to instantiating the message loop. This could be turned into a |
| 402 // broadcast notification. | 412 // broadcast notification. |
| 403 Platform::WillInitializeMainMessageLoop(parameters); | 413 Platform::WillInitializeMainMessageLoop(parameters); |
| 404 | 414 |
| 405 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 415 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| 406 | 416 |
| 407 SystemMonitor system_monitor; | 417 SystemMonitor system_monitor; |
| 408 HighResolutionTimerManager hi_res_timer_manager; | 418 HighResolutionTimerManager hi_res_timer_manager; |
| 409 | 419 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 parsed_command_line.HasSwitch(switches::kShowIcons)) { | 722 parsed_command_line.HasSwitch(switches::kShowIcons)) { |
| 713 return HandleIconsCommands(parsed_command_line); | 723 return HandleIconsCommands(parsed_command_line); |
| 714 } else if (parsed_command_line.HasSwitch(switches::kMakeDefaultBrowser)) { | 724 } else if (parsed_command_line.HasSwitch(switches::kMakeDefaultBrowser)) { |
| 715 if (ShellIntegration::SetAsDefaultBrowser()) { | 725 if (ShellIntegration::SetAsDefaultBrowser()) { |
| 716 return ResultCodes::NORMAL_EXIT; | 726 return ResultCodes::NORMAL_EXIT; |
| 717 } else { | 727 } else { |
| 718 return ResultCodes::SHELL_INTEGRATION_FAILED; | 728 return ResultCodes::SHELL_INTEGRATION_FAILED; |
| 719 } | 729 } |
| 720 } | 730 } |
| 721 | 731 |
| 722 #if defined(OS_WIN) | |
| 723 if (parsed_command_line.HasSwitch(switches::kUseNSSForSSL) || | |
| 724 parsed_command_line.HasSwitch(switches::kUseSpdy)) { | |
| 725 net::ClientSocketFactory::SetSSLClientSocketFactory( | |
| 726 net::SSLClientSocketNSSFactory); | |
| 727 } | |
| 728 #endif | |
| 729 | |
| 730 // Try to create/load the profile. | 732 // Try to create/load the profile. |
| 731 ProfileManager* profile_manager = browser_process->profile_manager(); | 733 ProfileManager* profile_manager = browser_process->profile_manager(); |
| 732 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | 734 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); |
| 733 | 735 |
| 734 #if defined(OS_WIN) | 736 #if defined(OS_WIN) |
| 735 if (!profile) { | 737 if (!profile) { |
| 736 // Ideally, we should be able to run w/o access to disk. For now, we | 738 // Ideally, we should be able to run w/o access to disk. For now, we |
| 737 // prompt the user to pick a different user-data-dir and restart chrome | 739 // prompt the user to pick a different user-data-dir and restart chrome |
| 738 // with the new dir. | 740 // with the new dir. |
| 739 // http://code.google.com/p/chromium/issues/detail?id=11510 | 741 // http://code.google.com/p/chromium/issues/detail?id=11510 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 if (metrics) | 1013 if (metrics) |
| 1012 metrics->Stop(); | 1014 metrics->Stop(); |
| 1013 | 1015 |
| 1014 // browser_shutdown takes care of deleting browser_process, so we need to | 1016 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1015 // release it. | 1017 // release it. |
| 1016 browser_process.release(); | 1018 browser_process.release(); |
| 1017 browser_shutdown::Shutdown(); | 1019 browser_shutdown::Shutdown(); |
| 1018 | 1020 |
| 1019 return result_code; | 1021 return result_code; |
| 1020 } | 1022 } |
| OLD | NEW |