OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/infobars/core/infobar_delegate.h" | 5 #include "components/infobars/core/infobar_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
10 #include "components/infobars/core/infobar_manager.h" | 10 #include "components/infobars/core/infobar_manager.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 int InfoBarDelegate::GetIconId() const { | 36 int InfoBarDelegate::GetIconId() const { |
37 return kNoIconID; | 37 return kNoIconID; |
38 } | 38 } |
39 | 39 |
40 gfx::VectorIconId InfoBarDelegate::GetVectorIconId() const { | 40 gfx::VectorIconId InfoBarDelegate::GetVectorIconId() const { |
41 return gfx::VectorIconId::VECTOR_ICON_NONE; | 41 return gfx::VectorIconId::VECTOR_ICON_NONE; |
42 } | 42 } |
43 | 43 |
44 gfx::Image InfoBarDelegate::GetIcon() const { | 44 gfx::Image InfoBarDelegate::GetIcon() const { |
45 #if !defined(OS_IOS) && !defined(OS_ANDROID) | 45 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
46 if (ui::MaterialDesignController::IsModeMaterial()) { | 46 gfx::VectorIconId vector_id = GetVectorIconId(); |
47 gfx::VectorIconId vector_id = GetVectorIconId(); | 47 if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) { |
48 if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) { | 48 return gfx::Image(gfx::CreateVectorIcon(vector_id, 16, |
49 return gfx::Image(gfx::CreateVectorIcon(vector_id, 16, | 49 GetInfoBarType() == WARNING_TYPE |
50 GetInfoBarType() == WARNING_TYPE | 50 ? SkColorSetRGB(0xFF, 0x67, 0) |
51 ? SkColorSetRGB(0xFF, 0x67, 0) | 51 : gfx::kGoogleBlue500)); |
52 : gfx::kGoogleBlue500)); | |
53 } | |
54 } | 52 } |
55 #endif | 53 #endif |
56 | 54 |
57 int icon_id = GetIconId(); | 55 int icon_id = GetIconId(); |
58 return icon_id == kNoIconID ? gfx::Image() : | 56 return icon_id == kNoIconID ? gfx::Image() : |
59 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | 57 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); |
60 } | 58 } |
61 | 59 |
62 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | 60 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
63 return false; | 61 return false; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 MediaThrottleInfoBarDelegate* | 133 MediaThrottleInfoBarDelegate* |
136 InfoBarDelegate::AsMediaThrottleInfoBarDelegate() { | 134 InfoBarDelegate::AsMediaThrottleInfoBarDelegate() { |
137 return nullptr; | 135 return nullptr; |
138 } | 136 } |
139 #endif | 137 #endif |
140 | 138 |
141 InfoBarDelegate::InfoBarDelegate() : nav_entry_id_(0) { | 139 InfoBarDelegate::InfoBarDelegate() : nav_entry_id_(0) { |
142 } | 140 } |
143 | 141 |
144 } // namespace infobars | 142 } // namespace infobars |
OLD | NEW |