| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #else | 90 #else |
| 91 return PAGE_ACTION_TYPE; | 91 return PAGE_ACTION_TYPE; |
| 92 #endif | 92 #endif |
| 93 } | 93 } |
| 94 | 94 |
| 95 infobars::InfoBarDelegate::InfoBarIdentifier | 95 infobars::InfoBarDelegate::InfoBarIdentifier |
| 96 DefaultBrowserInfoBarDelegate::GetIdentifier() const { | 96 DefaultBrowserInfoBarDelegate::GetIdentifier() const { |
| 97 return DEFAULT_BROWSER_INFOBAR_DELEGATE; | 97 return DEFAULT_BROWSER_INFOBAR_DELEGATE; |
| 98 } | 98 } |
| 99 | 99 |
| 100 int DefaultBrowserInfoBarDelegate::GetIconId() const { | |
| 101 return IDR_PRODUCT_LOGO_32; | |
| 102 } | |
| 103 | |
| 104 gfx::VectorIconId DefaultBrowserInfoBarDelegate::GetVectorIconId() const { | 100 gfx::VectorIconId DefaultBrowserInfoBarDelegate::GetVectorIconId() const { |
| 105 #if defined(OS_MACOSX) || defined(OS_ANDROID) | |
| 106 return gfx::VectorIconId::VECTOR_ICON_NONE; | |
| 107 #else | |
| 108 return gfx::VectorIconId::CHROME_PRODUCT; | 101 return gfx::VectorIconId::CHROME_PRODUCT; |
| 109 #endif | |
| 110 } | 102 } |
| 111 | 103 |
| 112 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
| 113 gfx::Image DefaultBrowserInfoBarDelegate::GetIcon() const { | 105 gfx::Image DefaultBrowserInfoBarDelegate::GetIcon() const { |
| 114 // Experiment for the chrome product icon used on the default browser | 106 // Experiment for the chrome product icon used on the default browser |
| 115 // prompt. | 107 // prompt. |
| 116 if (ui::MaterialDesignController::IsModeMaterial()) { | 108 std::string icon_color = variations::GetVariationParamValue( |
| 117 std::string icon_color = variations::GetVariationParamValue( | 109 kDefaultBrowserPromptStyle, "IconColor"); |
| 118 kDefaultBrowserPromptStyle, "IconColor"); | 110 if (icon_color == "Colored") { |
| 119 if (icon_color == "Colored") { | 111 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 120 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 112 IDR_PRODUCT_LOGO_16); |
| 121 IDR_PRODUCT_LOGO_16); | 113 } |
| 122 } | 114 if ((icon_color == "Blue") && (GetInfoBarType() == WARNING_TYPE)) { |
| 123 if ((icon_color == "Blue") && (GetInfoBarType() == WARNING_TYPE)) { | 115 // WARNING_TYPE infobars use orange icons by default. |
| 124 // WARNING_TYPE infobars use orange icons by default. | 116 return gfx::Image( |
| 125 return gfx::Image( | 117 gfx::CreateVectorIcon(GetVectorIconId(), 16, gfx::kGoogleBlue500)); |
| 126 gfx::CreateVectorIcon(GetVectorIconId(), 16, gfx::kGoogleBlue500)); | |
| 127 } | |
| 128 } | 118 } |
| 129 return ConfirmInfoBarDelegate::GetIcon(); | 119 return ConfirmInfoBarDelegate::GetIcon(); |
| 130 } | 120 } |
| 131 #endif // defined(OS_WIN) | 121 #endif // defined(OS_WIN) |
| 132 | 122 |
| 133 bool DefaultBrowserInfoBarDelegate::ShouldExpire( | 123 bool DefaultBrowserInfoBarDelegate::ShouldExpire( |
| 134 const NavigationDetails& details) const { | 124 const NavigationDetails& details) const { |
| 135 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); | 125 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); |
| 136 } | 126 } |
| 137 | 127 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 const shell_integration::DefaultWebClientWorkerCallback& callback) { | 190 const shell_integration::DefaultWebClientWorkerCallback& callback) { |
| 201 return new shell_integration::DefaultBrowserWorker(callback); | 191 return new shell_integration::DefaultBrowserWorker(callback); |
| 202 } | 192 } |
| 203 | 193 |
| 204 void DefaultBrowserInfoBarDelegate::OnSetAsDefaultFinished( | 194 void DefaultBrowserInfoBarDelegate::OnSetAsDefaultFinished( |
| 205 shell_integration::DefaultWebClientState state) { | 195 shell_integration::DefaultWebClientState state) { |
| 206 infobar()->owner()->RemoveInfoBar(infobar()); | 196 infobar()->owner()->RemoveInfoBar(infobar()); |
| 207 } | 197 } |
| 208 | 198 |
| 209 } // namespace chrome | 199 } // namespace chrome |
| OLD | NEW |