diff options
author | estade <estade@chromium.org> | 2015-07-29 16:20:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-29 23:21:44 +0000 |
commit | e77f0e43314897c3039d798fa58991b060920361 (patch) | |
tree | 01a029ca12b6a9c2753a257330e92bf89a39a0cd | |
parent | f13f460c583eca6ebab6a28c9596228cfa8c5036 (diff) | |
download | chromium_src-e77f0e43314897c3039d798fa58991b060920361.zip chromium_src-e77f0e43314897c3039d798fa58991b060920361.tar.gz chromium_src-e77f0e43314897c3039d798fa58991b060920361.tar.bz2 |
Use vectorized icon for default extensions icons
BUG=505953
Review URL: https://codereview.chromium.org/1262513002
Cr-Commit-Position: refs/heads/master@{#341007}
-rw-r--r-- | chrome/app/theme/default_100_percent/common/extensions_section.png | bin | 6166 -> 0 bytes | |||
-rw-r--r-- | chrome/app/theme/default_200_percent/common/extensions_section.png | bin | 8155 -> 0 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 1 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_icon_manager.cc | 16 | ||||
-rw-r--r-- | chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc | 1 | ||||
-rw-r--r-- | chrome/browser/ui/views/website_settings/permissions_bubble_view.cc | 9 | ||||
-rw-r--r-- | ui/gfx/BUILD.gn | 1 | ||||
-rw-r--r-- | ui/gfx/vector_icons/extension.icon | 31 | ||||
-rw-r--r-- | ui/native_theme/common_theme.cc | 10 | ||||
-rw-r--r-- | ui/native_theme/native_theme.h | 2 |
10 files changed, 62 insertions, 9 deletions
diff --git a/chrome/app/theme/default_100_percent/common/extensions_section.png b/chrome/app/theme/default_100_percent/common/extensions_section.png Binary files differdeleted file mode 100644 index 2ea68cb..0000000 --- a/chrome/app/theme/default_100_percent/common/extensions_section.png +++ /dev/null diff --git a/chrome/app/theme/default_200_percent/common/extensions_section.png b/chrome/app/theme/default_200_percent/common/extensions_section.png Binary files differdeleted file mode 100644 index d0d3c28..0000000 --- a/chrome/app/theme/default_200_percent/common/extensions_section.png +++ /dev/null diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 163ec07..5133c2f 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -267,7 +267,6 @@ <structure type="chrome_scaled_image" name="IDR_EXTENSIONS_RATING_STAR_HALF_RIGHT" file="common/extensions_rating_star_half_right.png" /> <structure type="chrome_scaled_image" name="IDR_EXTENSIONS_RATING_STAR_OFF" file="common/extensions_rating_star_off.png" /> <structure type="chrome_scaled_image" name="IDR_EXTENSIONS_RATING_STAR_ON" file="common/extensions_rating_star_on.png" /> - <structure type="chrome_scaled_image" name="IDR_EXTENSIONS_SECTION" file="common/extensions_section.png" /> <structure type="chrome_scaled_image" name="IDR_EXTENSION_COMMAND_CLOSE" file="common/extension_command_close.png" /> </if> <if expr="chromeos"> diff --git a/chrome/browser/extensions/extension_icon_manager.cc b/chrome/browser/extensions/extension_icon_manager.cc index a15b179..d1b58fd 100644 --- a/chrome/browser/extensions/extension_icon_manager.cc +++ b/chrome/browser/extensions/extension_icon_manager.cc @@ -21,7 +21,11 @@ #include "ui/gfx/favicon_size.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/image/image.h" +#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/skbitmap_operations.h" +#include "ui/gfx/vector_icons_public2.h" +#include "ui/native_theme/common_theme.h" +#include "ui/native_theme/native_theme.h" namespace { @@ -108,9 +112,15 @@ void ExtensionIconManager::OnImageLoaded(const std::string& extension_id, void ExtensionIconManager::EnsureDefaultIcon() { if (default_icon_.empty()) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - SkBitmap src = rb.GetImageNamed(IDR_EXTENSIONS_SECTION).AsBitmap(); - default_icon_ = ApplyTransforms(src); + SkColor icon_color; + ui::CommonThemeGetSystemColor(ui::NativeTheme::kColorId_ChromeIconGrey, + &icon_color); + // TODO(estade): use correct scale factor instead of 1x. + default_icon_ = + ApplyPadding(*gfx::CreateVectorIcon(gfx::VectorIconId::EXTENSION, + gfx::kFaviconSize, icon_color) + .bitmap(), + padding_); } } diff --git a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc index e8b4c30..480f469 100644 --- a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc +++ b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc @@ -417,6 +417,7 @@ GdkColor NativeThemeGtk2::GetSystemGdkColor(ColorId color_id) const { GetWindowStyle()->bg[GTK_STATE_NORMAL], 0xff / 2); } + case kColorId_ChromeIconGrey: case kColorId_NumColors: NOTREACHED(); break; diff --git a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc index 3f614ba..81a334f 100644 --- a/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc +++ b/chrome/browser/ui/views/website_settings/permissions_bubble_view.cc @@ -25,6 +25,8 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/text_constants.h" +#include "ui/native_theme/common_theme.h" +#include "ui/native_theme/native_theme.h" #include "ui/views/bubble/bubble_delegate.h" #include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/controls/button/checkbox.h" @@ -244,9 +246,10 @@ PermissionsBubbleDelegateView::PermissionsBubbleDelegateView( views::ImageView* icon = new views::ImageView(); gfx::VectorIconId vector_id = requests[index]->GetVectorIconId(); if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) { - // TODO(estade): move this color to a shared location? - icon->SetImage(gfx::CreateVectorIcon(vector_id, kIconSize, - SkColorSetRGB(0x5A, 0x5A, 0x5A))); + SkColor grey; + ui::CommonThemeGetSystemColor(ui::NativeTheme::kColorId_ChromeIconGrey, + &grey); + icon->SetImage(gfx::CreateVectorIcon(vector_id, kIconSize, grey)); } else { icon->SetImage(bundle.GetImageSkiaNamed(requests.at(index)->GetIconID())); icon->SetImageSize(gfx::Size(kIconSize, kIconSize)); diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn index 353e18b..da3fff1 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -400,6 +400,7 @@ action("aggregate_vector_icons") { script = "vector_icons/aggregate_vector_icons.py" sources = [ "vector_icons/check_circle.icon", + "vector_icons/extension.icon", "vector_icons/help_outline.icon", "vector_icons/location_on.icon", "vector_icons/notifications.icon", diff --git a/ui/gfx/vector_icons/extension.icon b/ui/gfx/vector_icons/extension.icon new file mode 100644 index 0000000..cb16063 --- /dev/null +++ b/ui/gfx/vector_icons/extension.icon @@ -0,0 +1,31 @@ +MOVE_TO, 41, 22, +R_H_LINE_TO, -3, +R_V_LINE_TO, -8, +R_CUBIC_TO, 0, -2.21f, -1.79f, -4, -4, -4, +R_H_LINE_TO, -8, +V_LINE_TO, 7, +R_CUBIC_TO, 0, -2.76f, -2.24f, -5, -5, -5, +R_CUBIC_TO, -2.76f, 0, -5, 2.24f, -5, 5, +R_V_LINE_TO, 3, +H_LINE_TO, 8, +R_CUBIC_TO, -2.21f, 0, -3.98f, 1.79f, -3.98f, 4, +R_LINE_TO, -0.01f, 7.6f, +H_LINE_TO, 7, +R_CUBIC_TO, 2.98f, 0, 5.4f, 2.42f, 5.4f, 5.4f, +R_CUBIC_TO, 0, 2.98f, -2.42f, 5.4f, -5.4f, 5.4f, +H_LINE_TO, 4.01f, +LINE_TO, 4, 40, +R_CUBIC_TO, 0, 2.21f, 1.79f, 4, 4, 4, +R_H_LINE_TO, 7.6f, +R_V_LINE_TO, -3, +R_CUBIC_TO, 0, -2.98f, 2.42f, -5.4f, 5.4f, -5.4f, +R_CUBIC_TO, 2.98f, 0, 5.4f, 2.42f, 5.4f, 5.4f, +R_V_LINE_TO, 3, +H_LINE_TO, 34, +R_CUBIC_TO, 2.21f, 0, 4, -1.79f, 4, -4, +R_V_LINE_TO, -8, +R_H_LINE_TO, 3, +R_CUBIC_TO, 2.76f, 0, 5, -2.24f, 5, -5, +R_CUBIC_TO, 0, -2.76f, -2.24f, -5, -5, -5, +CLOSE, +END diff --git a/ui/native_theme/common_theme.cc b/ui/native_theme/common_theme.cc index f41750c..5c0da01 100644 --- a/ui/native_theme/common_theme.cc +++ b/ui/native_theme/common_theme.cc @@ -39,8 +39,10 @@ const SkColor kBlueButtonDisabledColor = SK_ColorWHITE; const SkColor kBlueButtonPressedColor = SK_ColorWHITE; const SkColor kBlueButtonHoverColor = SK_ColorWHITE; const SkColor kBlueButtonShadowColor = SkColorSetRGB(0x53, 0x8C, 0xEA); +// Material colors: +const SkColor kGoogleBlue = SkColorSetRGB(0x42, 0x85, 0xF4); +const SkColor kChromeIconGrey = SkColorSetRGB(0x5A, 0x5A, 0x5A); // Material spinner/throbber: -const SkColor kThrobberSpinningColor = SkColorSetRGB(0x42, 0x85, 0xF4); const SkColor kThrobberWaitingColor = SkColorSetRGB(0xA6, 0xA6, 0xA6); const SkColor kThrobberLightColor = SkColorSetRGB(0xF4, 0xF8, 0xFD); @@ -109,9 +111,13 @@ bool CommonThemeGetSystemColor(NativeTheme::ColorId color_id, SkColor* color) { case NativeTheme::kColorId_BlueButtonShadowColor: *color = kBlueButtonShadowColor; break; + // Material icons + case NativeTheme::kColorId_ChromeIconGrey: + *color = kChromeIconGrey; + break; // Material spinner/throbber case NativeTheme::kColorId_ThrobberSpinningColor: - *color = kThrobberSpinningColor; + *color = kGoogleBlue; break; case NativeTheme::kColorId_ThrobberWaitingColor: *color = kThrobberWaitingColor; diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h index 9ceae9d..f429767 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h @@ -324,6 +324,8 @@ class NATIVE_THEME_EXPORT NativeTheme { kColorId_ResultsTableNegativeText, kColorId_ResultsTableNegativeHoveredText, kColorId_ResultsTableNegativeSelectedText, + // For MD icons. + kColorId_ChromeIconGrey, // Colors for the material spinner (aka throbber). kColorId_ThrobberSpinningColor, kColorId_ThrobberWaitingColor, |