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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 #if defined(USE_AURA) | 251 #if defined(USE_AURA) |
252 #include "ui/aura/env.h" | 252 #include "ui/aura/env.h" |
253 #endif // defined(USE_AURA) | 253 #endif // defined(USE_AURA) |
254 | 254 |
255 #if !defined(OS_ANDROID) | 255 #if !defined(OS_ANDROID) |
256 #include "chrome/browser/chrome_webusb_browser_client.h" | 256 #include "chrome/browser/chrome_webusb_browser_client.h" |
257 #include "components/webusb/webusb_detector.h" | 257 #include "components/webusb/webusb_detector.h" |
258 #endif | 258 #endif |
259 | 259 |
| 260 #if defined(MOJO_SHELL_CLIENT) |
| 261 #include "chrome/browser/lifetime/application_lifetime.h" |
| 262 #include "content/public/common/mojo_shell_connection.h" |
| 263 #endif |
| 264 |
260 using content::BrowserThread; | 265 using content::BrowserThread; |
261 | 266 |
262 namespace { | 267 namespace { |
263 | 268 |
264 // This function provides some ways to test crash and assertion handling | 269 // This function provides some ways to test crash and assertion handling |
265 // behavior of the program. | 270 // behavior of the program. |
266 void HandleTestParameters(const base::CommandLine& command_line) { | 271 void HandleTestParameters(const base::CommandLine& command_line) { |
267 // This parameter causes a null pointer crash (crash reporter trigger). | 272 // This parameter causes a null pointer crash (crash reporter trigger). |
268 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { | 273 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { |
269 int* bad_pointer = NULL; | 274 int* bad_pointer = NULL; |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. | 1136 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. |
1132 SetupMetricsAndFieldTrials(); | 1137 SetupMetricsAndFieldTrials(); |
1133 | 1138 |
1134 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. | 1139 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. |
1135 browser_process_->PreCreateThreads(); | 1140 browser_process_->PreCreateThreads(); |
1136 | 1141 |
1137 return content::RESULT_CODE_NORMAL_EXIT; | 1142 return content::RESULT_CODE_NORMAL_EXIT; |
1138 } | 1143 } |
1139 | 1144 |
1140 void ChromeBrowserMainParts::PreMainMessageLoopRun() { | 1145 void ChromeBrowserMainParts::PreMainMessageLoopRun() { |
| 1146 #if defined(MOJO_SHELL_CLIENT) |
| 1147 if (content::MojoShellConnection::Get() && |
| 1148 content::MojoShellConnection::Get()->UsingExternalShell()) { |
| 1149 content::MojoShellConnection::Get()->SetConnectionLostClosure( |
| 1150 base::Bind(&chrome::SessionEnding)); |
| 1151 } |
| 1152 #endif |
1141 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); | 1153 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); |
1142 TRACK_SCOPED_REGION( | 1154 TRACK_SCOPED_REGION( |
1143 "Startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); | 1155 "Startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); |
1144 | 1156 |
1145 result_code_ = PreMainMessageLoopRunImpl(); | 1157 result_code_ = PreMainMessageLoopRunImpl(); |
1146 | 1158 |
1147 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1159 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1148 chrome_extra_parts_[i]->PreMainMessageLoopRun(); | 1160 chrome_extra_parts_[i]->PreMainMessageLoopRun(); |
1149 } | 1161 } |
1150 | 1162 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 chromeos::CrosSettings::Shutdown(); | 1948 chromeos::CrosSettings::Shutdown(); |
1937 #endif // defined(OS_CHROMEOS) | 1949 #endif // defined(OS_CHROMEOS) |
1938 #endif // defined(OS_ANDROID) | 1950 #endif // defined(OS_ANDROID) |
1939 } | 1951 } |
1940 | 1952 |
1941 // Public members: | 1953 // Public members: |
1942 | 1954 |
1943 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1955 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1944 chrome_extra_parts_.push_back(parts); | 1956 chrome_extra_parts_.push_back(parts); |
1945 } | 1957 } |
OLD | NEW |