| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "chrome/app/vector_icons/vector_icons.h" |
| 11 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 12 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 12 #include "chrome/grit/chromium_strings.h" | 13 #include "chrome/grit/chromium_strings.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/infobars/core/infobar.h" | 15 #include "components/infobars/core/infobar.h" |
| 15 #include "content/public/browser/user_metrics.h" | 16 #include "content/public/browser/user_metrics.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/gfx/vector_icons_public.h" | |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 namespace chrome { | 23 namespace chrome { |
| 24 | 24 |
| 25 bool IsStickyDefaultBrowserPromptEnabled() { | 25 bool IsStickyDefaultBrowserPromptEnabled() { |
| 26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 27 // The flow to set the default browser is only asynchronous on Windows 10+. | 27 // The flow to set the default browser is only asynchronous on Windows 10+. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 infobars::InfoBarDelegate::Type DefaultBrowserInfoBarDelegate::GetInfoBarType() | 71 infobars::InfoBarDelegate::Type DefaultBrowserInfoBarDelegate::GetInfoBarType() |
| 72 const { | 72 const { |
| 73 return PAGE_ACTION_TYPE; | 73 return PAGE_ACTION_TYPE; |
| 74 } | 74 } |
| 75 | 75 |
| 76 infobars::InfoBarDelegate::InfoBarIdentifier | 76 infobars::InfoBarDelegate::InfoBarIdentifier |
| 77 DefaultBrowserInfoBarDelegate::GetIdentifier() const { | 77 DefaultBrowserInfoBarDelegate::GetIdentifier() const { |
| 78 return DEFAULT_BROWSER_INFOBAR_DELEGATE; | 78 return DEFAULT_BROWSER_INFOBAR_DELEGATE; |
| 79 } | 79 } |
| 80 | 80 |
| 81 gfx::VectorIconId DefaultBrowserInfoBarDelegate::GetVectorIconId() const { | 81 const gfx::VectorIcon& DefaultBrowserInfoBarDelegate::GetVectorIcon() const { |
| 82 return gfx::VectorIconId::PRODUCT; | 82 return kProductIcon; |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool DefaultBrowserInfoBarDelegate::ShouldExpire( | 85 bool DefaultBrowserInfoBarDelegate::ShouldExpire( |
| 86 const NavigationDetails& details) const { | 86 const NavigationDetails& details) const { |
| 87 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); | 87 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void DefaultBrowserInfoBarDelegate::InfoBarDismissed() { | 90 void DefaultBrowserInfoBarDelegate::InfoBarDismissed() { |
| 91 action_taken_ = true; | 91 action_taken_ = true; |
| 92 // |profile_| may be null in tests. | 92 // |profile_| may be null in tests. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 const shell_integration::DefaultWebClientWorkerCallback& callback) { | 152 const shell_integration::DefaultWebClientWorkerCallback& callback) { |
| 153 return new shell_integration::DefaultBrowserWorker(callback); | 153 return new shell_integration::DefaultBrowserWorker(callback); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void DefaultBrowserInfoBarDelegate::OnSetAsDefaultFinished( | 156 void DefaultBrowserInfoBarDelegate::OnSetAsDefaultFinished( |
| 157 shell_integration::DefaultWebClientState state) { | 157 shell_integration::DefaultWebClientState state) { |
| 158 infobar()->owner()->RemoveInfoBar(infobar()); | 158 infobar()->owner()->RemoveInfoBar(infobar()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace chrome | 161 } // namespace chrome |
| OLD | NEW |