diff options
author | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 09:39:05 +0000 |
---|---|---|
committer | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 09:39:05 +0000 |
commit | b9ff6038225f41483a19f61cc2f5290a4da7ad30 (patch) | |
tree | 900d5c118d7b9bf449e0ac6788dc167d98ef0dd8 /ui | |
parent | b7090e6dd08a6cbb1f45a3667b3e33ed3a621879 (diff) | |
download | chromium_src-b9ff6038225f41483a19f61cc2f5290a4da7ad30.zip chromium_src-b9ff6038225f41483a19f61cc2f5290a4da7ad30.tar.gz chromium_src-b9ff6038225f41483a19f61cc2f5290a4da7ad30.tar.bz2 |
Add contents switcher button icons for experimental app list.
This CL adds assets for the ContentsSwitcherView buttons which replace the
grey box placeholders that were previously used. This CL also changes the
contents switcher view to size correctly to the new buttons.
BUG=370759
Review URL: https://codereview.chromium.org/270263002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app_list/views/contents_switcher_view.cc | 62 | ||||
-rw-r--r-- | ui/app_list/views/contents_switcher_view.h | 4 | ||||
-rw-r--r-- | ui/resources/default_100_percent/common/app_list_apps_icon.png | bin | 0 -> 108 bytes | |||
-rw-r--r-- | ui/resources/default_100_percent/common/app_list_notifications_icon.png | bin | 0 -> 308 bytes | |||
-rw-r--r-- | ui/resources/default_100_percent/common/app_list_search_icon.png | bin | 0 -> 872 bytes | |||
-rw-r--r-- | ui/resources/default_200_percent/common/app_list_apps_icon.png | bin | 0 -> 137 bytes | |||
-rw-r--r-- | ui/resources/default_200_percent/common/app_list_notifications_icon.png | bin | 0 -> 558 bytes | |||
-rw-r--r-- | ui/resources/default_200_percent/common/app_list_search_icon.png | bin | 0 -> 2211 bytes | |||
-rw-r--r-- | ui/resources/ui_resources.grd | 3 |
9 files changed, 23 insertions, 46 deletions
diff --git a/ui/app_list/views/contents_switcher_view.cc b/ui/app_list/views/contents_switcher_view.cc index d931720..07e5991 100644 --- a/ui/app_list/views/contents_switcher_view.cc +++ b/ui/app_list/views/contents_switcher_view.cc @@ -4,58 +4,20 @@ #include "ui/app_list/views/contents_switcher_view.h" +#include "grit/ui_resources.h" #include "ui/app_list/app_list_constants.h" #include "ui/app_list/views/contents_view.h" -#include "ui/gfx/canvas.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/views/controls/button/custom_button.h" +#include "ui/views/controls/button/image_button.h" #include "ui/views/layout/box_layout.h" namespace app_list { namespace { -const int kPreferredHeight = 36; - +const int kPreferredHeight = 32; const int kButtonSpacing = 4; -const int kButtonWidth = 36; -const int kButtonHeight = 36; - -class ContentsSwitcherButton : public views::CustomButton { - public: - explicit ContentsSwitcherButton(views::ButtonListener* listener, - ContentsView::ShowState show_state) - : views::CustomButton(listener) { - set_tag(show_state); - } - - virtual ~ContentsSwitcherButton() {} - - // Overridden from views::View: - virtual gfx::Size GetPreferredSize() OVERRIDE { - return gfx::Size(kButtonWidth, kButtonHeight); - } - - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { - PaintButton( - canvas, - state() == STATE_HOVERED ? kPagerHoverColor : kPagerNormalColor); - } - - private: - // Paints a rectangular button. - void PaintButton(gfx::Canvas* canvas, SkColor base_color) { - gfx::Rect rect(GetContentsBounds()); - rect.ClampToCenteredSize(gfx::Size(kButtonWidth, kButtonHeight)); - - SkPaint paint; - paint.setAntiAlias(true); - paint.setStyle(SkPaint::kFill_Style); - paint.setColor(base_color); - canvas->DrawRect(rect, paint); - } - - DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherButton); -}; } // namespace @@ -65,14 +27,22 @@ ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view) buttons_->SetLayoutManager(new views::BoxLayout( views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing)); - buttons_->AddChildView( - new ContentsSwitcherButton(this, ContentsView::SHOW_APPS)); - buttons_->AddChildView( - new ContentsSwitcherButton(this, ContentsView::SHOW_SEARCH_RESULTS)); + AddSwitcherButton(IDR_APP_LIST_SEARCH_ICON, + ContentsView::SHOW_SEARCH_RESULTS); + AddSwitcherButton(IDR_APP_LIST_APPS_ICON, ContentsView::SHOW_APPS); } ContentsSwitcherView::~ContentsSwitcherView() {} +void ContentsSwitcherView::AddSwitcherButton(int resource_id, int tag) { + views::ImageButton* button = new views::ImageButton(this); + button->SetImage( + views::CustomButton::STATE_NORMAL, + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id)); + button->set_tag(tag); + buttons_->AddChildView(button); +} + gfx::Size ContentsSwitcherView::GetPreferredSize() { return gfx::Size(buttons_->GetPreferredSize().width(), kPreferredHeight); } diff --git a/ui/app_list/views/contents_switcher_view.h b/ui/app_list/views/contents_switcher_view.h index df6d6fea..fcbcfbf 100644 --- a/ui/app_list/views/contents_switcher_view.h +++ b/ui/app_list/views/contents_switcher_view.h @@ -21,6 +21,10 @@ class ContentsSwitcherView : public views::View, public views::ButtonListener { virtual ~ContentsSwitcherView(); private: + // Adds a switcher button using |resource_id| as the button's image and |tag| + // as the button's id. + void AddSwitcherButton(int resource_id, int tag); + // Overridden from views::View: virtual gfx::Size GetPreferredSize() OVERRIDE; virtual void Layout() OVERRIDE; diff --git a/ui/resources/default_100_percent/common/app_list_apps_icon.png b/ui/resources/default_100_percent/common/app_list_apps_icon.png Binary files differnew file mode 100644 index 0000000..e779080 --- /dev/null +++ b/ui/resources/default_100_percent/common/app_list_apps_icon.png diff --git a/ui/resources/default_100_percent/common/app_list_notifications_icon.png b/ui/resources/default_100_percent/common/app_list_notifications_icon.png Binary files differnew file mode 100644 index 0000000..4bf4c24 --- /dev/null +++ b/ui/resources/default_100_percent/common/app_list_notifications_icon.png diff --git a/ui/resources/default_100_percent/common/app_list_search_icon.png b/ui/resources/default_100_percent/common/app_list_search_icon.png Binary files differnew file mode 100644 index 0000000..8bb0ea2 --- /dev/null +++ b/ui/resources/default_100_percent/common/app_list_search_icon.png diff --git a/ui/resources/default_200_percent/common/app_list_apps_icon.png b/ui/resources/default_200_percent/common/app_list_apps_icon.png Binary files differnew file mode 100644 index 0000000..919a97a --- /dev/null +++ b/ui/resources/default_200_percent/common/app_list_apps_icon.png diff --git a/ui/resources/default_200_percent/common/app_list_notifications_icon.png b/ui/resources/default_200_percent/common/app_list_notifications_icon.png Binary files differnew file mode 100644 index 0000000..60eb800 --- /dev/null +++ b/ui/resources/default_200_percent/common/app_list_notifications_icon.png diff --git a/ui/resources/default_200_percent/common/app_list_search_icon.png b/ui/resources/default_200_percent/common/app_list_search_icon.png Binary files differnew file mode 100644 index 0000000..c3ae54b --- /dev/null +++ b/ui/resources/default_200_percent/common/app_list_search_icon.png diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd index c796db3..4096fe2 100644 --- a/ui/resources/ui_resources.grd +++ b/ui/resources/ui_resources.grd @@ -15,15 +15,18 @@ BECAUSE YOUR RESOURCES ARE FUNCTIONALLY RELATED OR FALL UNDER THE SAME CONDITIONALS. --> <if expr="enable_app_list"> + <structure type="chrome_scaled_image" name="IDR_APP_LIST_APPS_ICON" file="common/app_list_apps_icon.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_EXPERIMENTAL_ICON" file="common/app_list_experimental_icon.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_BACKGROUND" file="common/app_list_progress_bar_background.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_LEFT" file="common/app_list_progress_bar_left.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_CENTER" file="common/app_list_progress_bar_center.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_ITEM_PROGRESS_RIGHT" file="common/app_list_progress_bar_right.png" /> + <structure type="chrome_scaled_image" name="IDR_APP_LIST_NOTIFICATIONS_ICON" file="common/app_list_notifications_icon.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_TOOLS_HOVER" file="common/app_list_tools_hover.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_TOOLS_NORMAL" file="common/app_list_tools_normal.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_TOOLS_PRESSED" file="common/app_list_tools_pressed.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_FOLDER_BACK_NORMAL" file="common/app_list_folder_back_normal.png" /> + <structure type="chrome_scaled_image" name="IDR_APP_LIST_SEARCH_ICON" file="common/app_list_search_icon.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_SPEECH_MIC_ON" file="common/app_list_mic_on.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_SPEECH_MIC_OFF" file="common/app_list_mic_off.png" /> <structure type="chrome_scaled_image" name="IDR_APP_LIST_SPEECH_MIC_RECORDING" file="common/app_list_mic_recording.png" /> |