Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: ui/app_list/views/contents_switcher_view.cc

Issue 581923002: Experimental launcher: Switcher buttons are larger and centered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ares-switcher-button-cropping
Patch Set: Rebase. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/app_list/views/contents_switcher_view.h" 5 #include "ui/app_list/views/contents_switcher_view.h"
6 6
7 #include "ui/app_list/views/contents_view.h" 7 #include "ui/app_list/views/contents_view.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/views/controls/button/custom_button.h" 9 #include "ui/views/controls/button/custom_button.h"
10 #include "ui/views/controls/button/image_button.h" 10 #include "ui/views/controls/button/image_button.h"
(...skipping 14 matching lines...) Expand all
25 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing); 25 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing);
26 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); 26 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
27 layout->set_minimum_cross_axis_size(kMinimumHeight); 27 layout->set_minimum_cross_axis_size(kMinimumHeight);
28 SetLayoutManager(layout); 28 SetLayoutManager(layout);
29 } 29 }
30 30
31 ContentsSwitcherView::~ContentsSwitcherView() {} 31 ContentsSwitcherView::~ContentsSwitcherView() {}
32 32
33 void ContentsSwitcherView::AddSwitcherButton(int resource_id, int page_index) { 33 void ContentsSwitcherView::AddSwitcherButton(int resource_id, int page_index) {
34 views::ImageButton* button = new views::ImageButton(this); 34 views::ImageButton* button = new views::ImageButton(this);
35 button->SetMinimumImageSize(gfx::Size(kMinimumHeight, kMinimumHeight));
36 button->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
37 views::ImageButton::ALIGN_MIDDLE);
35 button->SetImage( 38 button->SetImage(
36 views::CustomButton::STATE_NORMAL, 39 views::CustomButton::STATE_NORMAL,
37 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id)); 40 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id));
38 button->set_tag(page_index); 41 button->set_tag(page_index);
39 42
40 AddChildView(button); 43 AddChildView(button);
41 } 44 }
42 45
43 void ContentsSwitcherView::ButtonPressed(views::Button* sender, 46 void ContentsSwitcherView::ButtonPressed(views::Button* sender,
44 const ui::Event& event) { 47 const ui::Event& event) {
(...skipping 19 matching lines...) Expand all
64 if (pm.IsRevertingCurrentTransition()) { 67 if (pm.IsRevertingCurrentTransition()) {
65 // Swap the direction if the transition is reversed. 68 // Swap the direction if the transition is reversed.
66 old_selected = pm.transition().target_page; 69 old_selected = pm.transition().target_page;
67 new_selected = pm.selected_page(); 70 new_selected = pm.selected_page();
68 } 71 }
69 72
70 SelectedPageChanged(old_selected, new_selected); 73 SelectedPageChanged(old_selected, new_selected);
71 } 74 }
72 75
73 } // namespace app_list 76 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698