Chromium Code Reviews| 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 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 // progress and should not be taken as an indication of a real refactoring. | 202 // progress and should not be taken as an indication of a real refactoring. |
| 203 | 203 |
| 204 #if defined(OS_WIN) | 204 #if defined(OS_WIN) |
| 205 #include "base/trace_event/trace_event_etw_export_win.h" | 205 #include "base/trace_event/trace_event_etw_export_win.h" |
| 206 #include "base/win/win_util.h" | 206 #include "base/win/win_util.h" |
| 207 #include "chrome/browser/chrome_browser_main_win.h" | 207 #include "chrome/browser/chrome_browser_main_win.h" |
| 208 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" | 208 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
| 209 #include "chrome/browser/downgrade/user_data_downgrade.h" | 209 #include "chrome/browser/downgrade/user_data_downgrade.h" |
| 210 #include "chrome/browser/first_run/upgrade_util_win.h" | 210 #include "chrome/browser/first_run/upgrade_util_win.h" |
| 211 #include "chrome/browser/ui/network_profile_bubble.h" | 211 #include "chrome/browser/ui/network_profile_bubble.h" |
| 212 #include "chrome/browser/ui/views/try_chrome_dialog_view.h" | 212 #include "chrome/browser/ui/views/try_chrome_dialog.h" |
| 213 #include "chrome/browser/win/browser_util.h" | 213 #include "chrome/browser/win/browser_util.h" |
| 214 #include "chrome/browser/win/chrome_select_file_dialog_factory.h" | 214 #include "chrome/browser/win/chrome_select_file_dialog_factory.h" |
| 215 #include "chrome/install_static/install_util.h" | 215 #include "chrome/install_static/install_util.h" |
| 216 #include "ui/base/l10n/l10n_util_win.h" | 216 #include "ui/base/l10n/l10n_util_win.h" |
| 217 #include "ui/shell_dialogs/select_file_dialog.h" | 217 #include "ui/shell_dialogs/select_file_dialog.h" |
| 218 #endif // defined(OS_WIN) | 218 #endif // defined(OS_WIN) |
| 219 | 219 |
| 220 #if defined(OS_MACOSX) | 220 #if defined(OS_MACOSX) |
| 221 #include <Security/Security.h> | 221 #include <Security/Security.h> |
| 222 | 222 |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1558 std::string try_chrome = | 1558 std::string try_chrome = |
| 1559 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); | 1559 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); |
| 1560 if (!try_chrome.empty()) { | 1560 if (!try_chrome.empty()) { |
| 1561 #if defined(OS_WIN) | 1561 #if defined(OS_WIN) |
| 1562 // Setup.exe has determined that we need to run a retention experiment | 1562 // Setup.exe has determined that we need to run a retention experiment |
| 1563 // and has lauched chrome to show the experiment UI. It is guaranteed that | 1563 // and has lauched chrome to show the experiment UI. It is guaranteed that |
| 1564 // no other Chrome is currently running as the process singleton was | 1564 // no other Chrome is currently running as the process singleton was |
| 1565 // successfully grabbed above. | 1565 // successfully grabbed above. |
| 1566 int try_chrome_int; | 1566 int try_chrome_int; |
| 1567 base::StringToInt(try_chrome, &try_chrome_int); | 1567 base::StringToInt(try_chrome, &try_chrome_int); |
| 1568 TryChromeDialogView::Result answer = TryChromeDialogView::Show( | 1568 TryChromeDialog::Result answer = TryChromeDialog::Show( |
| 1569 try_chrome_int, | 1569 try_chrome_int, |
| 1570 base::Bind(&ChromeProcessSingleton::SetActiveModalDialog, | 1570 base::Bind(&ChromeProcessSingleton::SetActiveModalDialog, |
| 1571 base::Unretained(process_singleton_.get()))); | 1571 base::Unretained(process_singleton_.get()))); |
| 1572 if (answer == TryChromeDialogView::NOT_NOW) | 1572 if (answer == TryChromeDialog::NOT_NOW) { |
|
sky
2017/07/18 17:10:31
no {} That said, wouldn't a switch be better here?
skare_
2017/07/21 03:11:35
case'd
| |
| 1573 return chrome::RESULT_CODE_NORMAL_EXIT_CANCEL; | 1573 return chrome::RESULT_CODE_NORMAL_EXIT_CANCEL; |
| 1574 if (answer == TryChromeDialogView::UNINSTALL_CHROME) | 1574 } |
| 1575 return chrome::RESULT_CODE_NORMAL_EXIT_EXP2; | 1575 // User asked to launch Chrome; welcome page is shown in some experimental |
| 1576 // At this point the user is willing to try chrome again. | 1576 // cases. |
| 1577 if (answer == TryChromeDialogView::TRY_CHROME_AS_DEFAULT) { | 1577 if (answer == TryChromeDialog::OPEN_CHROME_WELCOME) { |
| 1578 // Only set in the unattended case. This is not true on Windows 8+. | 1578 browser_creator_->set_welcome_back_page( |
| 1579 if (shell_integration::GetDefaultWebClientSetPermission() == | 1579 StartupBrowserCreator::WelcomeBackPage::kWelcomeStandard); |
| 1580 shell_integration::SET_DEFAULT_UNATTENDED) { | 1580 } else if (answer == TryChromeDialog::OPEN_CHROME_WELCOME_WIN10) { |
| 1581 shell_integration::SetAsDefaultBrowser(); | 1581 browser_creator_->set_welcome_back_page( |
| 1582 } | 1582 StartupBrowserCreator::WelcomeBackPage::kWelcomeWin10); |
| 1583 } | 1583 } |
| 1584 #else | 1584 #else |
| 1585 // We don't support retention experiments on Mac or Linux. | 1585 // We don't support retention experiments on Mac or Linux. |
| 1586 return content::RESULT_CODE_NORMAL_EXIT; | 1586 return content::RESULT_CODE_NORMAL_EXIT; |
| 1587 #endif // defined(OS_WIN) | 1587 #endif // defined(OS_WIN) |
| 1588 } | 1588 } |
| 1589 | 1589 |
| 1590 #if defined(OS_WIN) | 1590 #if defined(OS_WIN) |
| 1591 // Do the tasks if chrome has been upgraded while it was last running. | 1591 // Do the tasks if chrome has been upgraded while it was last running. |
| 1592 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) | 1592 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2064 chromeos::CrosSettings::Shutdown(); | 2064 chromeos::CrosSettings::Shutdown(); |
| 2065 #endif // defined(OS_CHROMEOS) | 2065 #endif // defined(OS_CHROMEOS) |
| 2066 #endif // defined(OS_ANDROID) | 2066 #endif // defined(OS_ANDROID) |
| 2067 } | 2067 } |
| 2068 | 2068 |
| 2069 // Public members: | 2069 // Public members: |
| 2070 | 2070 |
| 2071 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2071 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2072 chrome_extra_parts_.push_back(parts); | 2072 chrome_extra_parts_.push_back(parts); |
| 2073 } | 2073 } |
| OLD | NEW |