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 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 parsed_command_line.HasSwitch(switches::kShowIcons)) | 1267 parsed_command_line.HasSwitch(switches::kShowIcons)) |
1268 return HandleIconsCommands(parsed_command_line); | 1268 return HandleIconsCommands(parsed_command_line); |
1269 if (parsed_command_line.HasSwitch(switches::kMakeDefaultBrowser)) { | 1269 if (parsed_command_line.HasSwitch(switches::kMakeDefaultBrowser)) { |
1270 return ShellIntegration::SetAsDefaultBrowser() ? | 1270 return ShellIntegration::SetAsDefaultBrowser() ? |
1271 ResultCodes::NORMAL_EXIT : ResultCodes::SHELL_INTEGRATION_FAILED; | 1271 ResultCodes::NORMAL_EXIT : ResultCodes::SHELL_INTEGRATION_FAILED; |
1272 } | 1272 } |
1273 | 1273 |
1274 // If the command line specifies --pack-extension, attempt the pack extension | 1274 // If the command line specifies --pack-extension, attempt the pack extension |
1275 // startup action and exit. | 1275 // startup action and exit. |
1276 if (parsed_command_line.HasSwitch(switches::kPackExtension)) { | 1276 if (parsed_command_line.HasSwitch(switches::kPackExtension)) { |
1277 extensions_startup::HandlePackExtension(parsed_command_line); | 1277 ExtensionsStartupUtil extension_startup_util; |
1278 return ResultCodes::NORMAL_EXIT; | 1278 if (extension_startup_util.PackExtension(parsed_command_line)) { |
| 1279 return ResultCodes::NORMAL_EXIT; |
| 1280 } else { |
| 1281 return ResultCodes::PACK_EXTENSION_ERROR; |
| 1282 } |
1279 } | 1283 } |
1280 | 1284 |
1281 #if !defined(OS_MACOSX) | 1285 #if !defined(OS_MACOSX) |
1282 // In environments other than Mac OS X we support import of settings | 1286 // In environments other than Mac OS X we support import of settings |
1283 // from other browsers. In case this process is a short-lived "import" | 1287 // from other browsers. In case this process is a short-lived "import" |
1284 // process that another browser runs just to import the settings, we | 1288 // process that another browser runs just to import the settings, we |
1285 // don't want to be checking for another browser process, by design. | 1289 // don't want to be checking for another browser process, by design. |
1286 if (!(parsed_command_line.HasSwitch(switches::kImport) || | 1290 if (!(parsed_command_line.HasSwitch(switches::kImport) || |
1287 parsed_command_line.HasSwitch(switches::kImportFromFile))) { | 1291 parsed_command_line.HasSwitch(switches::kImportFromFile))) { |
1288 #endif | 1292 #endif |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 if (profile->GetExtensionsService()) { | 1567 if (profile->GetExtensionsService()) { |
1564 // This will initialize bookmarks. Call it after bookmark import is done. | 1568 // This will initialize bookmarks. Call it after bookmark import is done. |
1565 // See issue 40144. | 1569 // See issue 40144. |
1566 profile->GetExtensionsService()->InitEventRouters(); | 1570 profile->GetExtensionsService()->InitEventRouters(); |
1567 } | 1571 } |
1568 | 1572 |
1569 // The extension service may be available at this point. If the command line | 1573 // The extension service may be available at this point. If the command line |
1570 // specifies --uninstall-extension, attempt the uninstall extension startup | 1574 // specifies --uninstall-extension, attempt the uninstall extension startup |
1571 // action. | 1575 // action. |
1572 if (parsed_command_line.HasSwitch(switches::kUninstallExtension)) { | 1576 if (parsed_command_line.HasSwitch(switches::kUninstallExtension)) { |
1573 if (extensions_startup::HandleUninstallExtension(parsed_command_line, | 1577 ExtensionsStartupUtil ext_startup_util; |
1574 profile)) { | 1578 if (ext_startup_util.UninstallExtension(parsed_command_line, profile)) { |
1575 return ResultCodes::NORMAL_EXIT; | 1579 return ResultCodes::NORMAL_EXIT; |
1576 } else { | 1580 } else { |
1577 return ResultCodes::UNINSTALL_EXTENSION_ERROR; | 1581 return ResultCodes::UNINSTALL_EXTENSION_ERROR; |
1578 } | 1582 } |
1579 } | 1583 } |
1580 | 1584 |
1581 #if defined(OS_WIN) | 1585 #if defined(OS_WIN) |
1582 // We check this here because if the profile is OTR (chromeos possibility) | 1586 // We check this here because if the profile is OTR (chromeos possibility) |
1583 // it won't still be accessible after browser is destroyed. | 1587 // it won't still be accessible after browser is destroyed. |
1584 bool record_search_engine = is_first_run && !profile->IsOffTheRecord(); | 1588 bool record_search_engine = is_first_run && !profile->IsOffTheRecord(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 #if defined(OS_CHROMEOS) | 1720 #if defined(OS_CHROMEOS) |
1717 // To be precise, logout (browser shutdown) is not yet done, but the | 1721 // To be precise, logout (browser shutdown) is not yet done, but the |
1718 // remaining work is negligible, hence we say LogoutDone here. | 1722 // remaining work is negligible, hence we say LogoutDone here. |
1719 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1723 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1720 false); | 1724 false); |
1721 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1725 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1722 #endif | 1726 #endif |
1723 TRACE_EVENT_END("BrowserMain", 0, 0); | 1727 TRACE_EVENT_END("BrowserMain", 0, 0); |
1724 return result_code; | 1728 return result_code; |
1725 } | 1729 } |
OLD | NEW |