| 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 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 std::string try_chrome = | 1548 std::string try_chrome = |
| 1549 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); | 1549 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); |
| 1550 if (!try_chrome.empty()) { | 1550 if (!try_chrome.empty()) { |
| 1551 #if defined(OS_WIN) | 1551 #if defined(OS_WIN) |
| 1552 // Setup.exe has determined that we need to run a retention experiment | 1552 // Setup.exe has determined that we need to run a retention experiment |
| 1553 // and has lauched chrome to show the experiment UI. It is guaranteed that | 1553 // and has lauched chrome to show the experiment UI. It is guaranteed that |
| 1554 // no other Chrome is currently running as the process singleton was | 1554 // no other Chrome is currently running as the process singleton was |
| 1555 // successfully grabbed above. | 1555 // successfully grabbed above. |
| 1556 int try_chrome_int; | 1556 int try_chrome_int; |
| 1557 base::StringToInt(try_chrome, &try_chrome_int); | 1557 base::StringToInt(try_chrome, &try_chrome_int); |
| 1558 StartupBrowserCreator::WelcomeBackPage welcome_page = |
| 1559 StartupBrowserCreator::WelcomeBackPage::kNone; |
| 1558 TryChromeDialogView::Result answer = TryChromeDialogView::Show( | 1560 TryChromeDialogView::Result answer = TryChromeDialogView::Show( |
| 1559 try_chrome_int, | 1561 try_chrome_int, |
| 1560 base::Bind(&ChromeProcessSingleton::SetActiveModalDialog, | 1562 base::Bind(&ChromeProcessSingleton::SetActiveModalDialog, |
| 1561 base::Unretained(process_singleton_.get()))); | 1563 base::Unretained(process_singleton_.get())), |
| 1562 if (answer == TryChromeDialogView::NOT_NOW) | 1564 &welcome_page); |
| 1565 if (answer != TryChromeDialogView::OPEN_CHROME) |
| 1563 return chrome::RESULT_CODE_NORMAL_EXIT_CANCEL; | 1566 return chrome::RESULT_CODE_NORMAL_EXIT_CANCEL; |
| 1564 if (answer == TryChromeDialogView::UNINSTALL_CHROME) | 1567 if (welcome_page != StartupBrowserCreator::WelcomeBackPage::kNone) |
| 1565 return chrome::RESULT_CODE_NORMAL_EXIT_EXP2; | 1568 browser_creator_->set_welcome_back_page(welcome_page); |
| 1566 // At this point the user is willing to try chrome again. | |
| 1567 if (answer == TryChromeDialogView::TRY_CHROME_AS_DEFAULT) { | |
| 1568 // Only set in the unattended case. This is not true on Windows 8+. | |
| 1569 if (shell_integration::GetDefaultWebClientSetPermission() == | |
| 1570 shell_integration::SET_DEFAULT_UNATTENDED) { | |
| 1571 shell_integration::SetAsDefaultBrowser(); | |
| 1572 } | |
| 1573 } | |
| 1574 #else | 1569 #else |
| 1575 // We don't support retention experiments on Mac or Linux. | 1570 // We don't support retention experiments on Mac or Linux. |
| 1576 return content::RESULT_CODE_NORMAL_EXIT; | 1571 return content::RESULT_CODE_NORMAL_EXIT; |
| 1577 #endif // defined(OS_WIN) | 1572 #endif // defined(OS_WIN) |
| 1578 } | 1573 } |
| 1579 | 1574 |
| 1580 #if defined(OS_WIN) | 1575 #if defined(OS_WIN) |
| 1581 // Do the tasks if chrome has been upgraded while it was last running. | 1576 // Do the tasks if chrome has been upgraded while it was last running. |
| 1582 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) | 1577 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) |
| 1583 return content::RESULT_CODE_NORMAL_EXIT; | 1578 return content::RESULT_CODE_NORMAL_EXIT; |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 chromeos::CrosSettings::Shutdown(); | 2049 chromeos::CrosSettings::Shutdown(); |
| 2055 #endif // defined(OS_CHROMEOS) | 2050 #endif // defined(OS_CHROMEOS) |
| 2056 #endif // defined(OS_ANDROID) | 2051 #endif // defined(OS_ANDROID) |
| 2057 } | 2052 } |
| 2058 | 2053 |
| 2059 // Public members: | 2054 // Public members: |
| 2060 | 2055 |
| 2061 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2056 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2062 chrome_extra_parts_.push_back(parts); | 2057 chrome_extra_parts_.push_back(parts); |
| 2063 } | 2058 } |
| OLD | NEW |