| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/startup/default_browser_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/default_browser_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 9 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 10 #include "chrome/grit/chromium_strings.h" | 10 #include "chrome/grit/chromium_strings.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); | 151 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); |
| 152 } | 152 } |
| 153 | 153 |
| 154 int DefaultBrowserInfoBarDelegate::GetButtons() const { | 154 int DefaultBrowserInfoBarDelegate::GetButtons() const { |
| 155 return BUTTON_OK; | 155 return BUTTON_OK; |
| 156 } | 156 } |
| 157 | 157 |
| 158 base::string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( | 158 base::string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( |
| 159 InfoBarButton button) const { | 159 InfoBarButton button) const { |
| 160 DCHECK_EQ(BUTTON_OK, button); | 160 DCHECK_EQ(BUTTON_OK, button); |
| 161 #if defined(OS_WIN) | 161 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_OK_BUTTON_LABEL); |
| 162 // On Windows 10, the "OK" button opens the Windows Settings application, | |
| 163 // through which the user must make their default browser choice. | |
| 164 const int kSetAsDefaultButtonMessageId = | |
| 165 base::win::GetVersion() >= base::win::VERSION_WIN10 | |
| 166 ? IDS_DEFAULT_BROWSER_INFOBAR_OK_BUTTON_LABEL_WIN_10 | |
| 167 : IDS_DEFAULT_BROWSER_INFOBAR_OK_BUTTON_LABEL; | |
| 168 #else | |
| 169 const int kSetAsDefaultButtonMessageId = | |
| 170 IDS_DEFAULT_BROWSER_INFOBAR_OK_BUTTON_LABEL; | |
| 171 #endif | |
| 172 return l10n_util::GetStringUTF16(kSetAsDefaultButtonMessageId); | |
| 173 } | 162 } |
| 174 | 163 |
| 175 // Setting an app as the default browser doesn't require elevation directly, but | 164 // Setting an app as the default browser doesn't require elevation directly, but |
| 176 // it does require registering it as the protocol handler for "http", so if | 165 // it does require registering it as the protocol handler for "http", so if |
| 177 // protocol registration in general requires elevation, this does as well. | 166 // protocol registration in general requires elevation, this does as well. |
| 178 bool DefaultBrowserInfoBarDelegate::OKButtonTriggersUACPrompt() const { | 167 bool DefaultBrowserInfoBarDelegate::OKButtonTriggersUACPrompt() const { |
| 179 return shell_integration::IsElevationNeededForSettingDefaultProtocolClient(); | 168 return shell_integration::IsElevationNeededForSettingDefaultProtocolClient(); |
| 180 } | 169 } |
| 181 | 170 |
| 182 bool DefaultBrowserInfoBarDelegate::Accept() { | 171 bool DefaultBrowserInfoBarDelegate::Accept() { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 211 const shell_integration::DefaultWebClientWorkerCallback& callback) { | 200 const shell_integration::DefaultWebClientWorkerCallback& callback) { |
| 212 return new shell_integration::DefaultBrowserWorker(callback); | 201 return new shell_integration::DefaultBrowserWorker(callback); |
| 213 } | 202 } |
| 214 | 203 |
| 215 void DefaultBrowserInfoBarDelegate::OnSetAsDefaultFinished( | 204 void DefaultBrowserInfoBarDelegate::OnSetAsDefaultFinished( |
| 216 shell_integration::DefaultWebClientState state) { | 205 shell_integration::DefaultWebClientState state) { |
| 217 infobar()->owner()->RemoveInfoBar(infobar()); | 206 infobar()->owner()->RemoveInfoBar(infobar()); |
| 218 } | 207 } |
| 219 | 208 |
| 220 } // namespace chrome | 209 } // namespace chrome |
| OLD | NEW |