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

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

Issue 186483004: Add a skeleton Start Page to the experimental app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ares_change_experimental_animation
Patch Set: fix initialization order Created 6 years, 7 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_main_view.cc ('k') | ui/app_list/views/contents_view.h » ('j') | 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 "grit/ui_resources.h" 7 #include "grit/ui_resources.h"
8 #include "ui/app_list/app_list_constants.h" 8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/views/contents_view.h" 9 #include "ui/app_list/views/contents_view.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/views/controls/button/custom_button.h" 11 #include "ui/views/controls/button/custom_button.h"
12 #include "ui/views/controls/button/image_button.h" 12 #include "ui/views/controls/button/image_button.h"
13 #include "ui/views/layout/box_layout.h" 13 #include "ui/views/layout/box_layout.h"
14 14
15 namespace app_list { 15 namespace app_list {
16 16
17 namespace { 17 namespace {
18 18
19 const int kPreferredHeight = 32; 19 const int kPreferredHeight = 32;
20 const int kButtonSpacing = 4; 20 const int kButtonSpacing = 4;
21 21
22 } // namespace 22 } // namespace
23 23
24 ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view) 24 ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view)
25 : contents_view_(contents_view), buttons_(new views::View) { 25 : contents_view_(contents_view), buttons_(new views::View) {
26 AddChildView(buttons_); 26 AddChildView(buttons_);
27 27
28 buttons_->SetLayoutManager(new views::BoxLayout( 28 buttons_->SetLayoutManager(new views::BoxLayout(
29 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing)); 29 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing));
30 AddSwitcherButton(IDR_APP_LIST_SEARCH_ICON, 30 AddSwitcherButton(IDR_APP_LIST_SEARCH_ICON, ContentsView::SHOW_START_PAGE);
31 ContentsView::SHOW_SEARCH_RESULTS);
32 AddSwitcherButton(IDR_APP_LIST_APPS_ICON, ContentsView::SHOW_APPS); 31 AddSwitcherButton(IDR_APP_LIST_APPS_ICON, ContentsView::SHOW_APPS);
33 } 32 }
34 33
35 ContentsSwitcherView::~ContentsSwitcherView() {} 34 ContentsSwitcherView::~ContentsSwitcherView() {}
36 35
37 void ContentsSwitcherView::AddSwitcherButton(int resource_id, int tag) { 36 void ContentsSwitcherView::AddSwitcherButton(int resource_id, int tag) {
38 views::ImageButton* button = new views::ImageButton(this); 37 views::ImageButton* button = new views::ImageButton(this);
39 button->SetImage( 38 button->SetImage(
40 views::CustomButton::STATE_NORMAL, 39 views::CustomButton::STATE_NORMAL,
41 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id)); 40 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id));
(...skipping 17 matching lines...) Expand all
59 buttons_->SetBoundsRect(gfx::IntersectRects(rect, buttons_bounds)); 58 buttons_->SetBoundsRect(gfx::IntersectRects(rect, buttons_bounds));
60 } 59 }
61 60
62 void ContentsSwitcherView::ButtonPressed(views::Button* sender, 61 void ContentsSwitcherView::ButtonPressed(views::Button* sender,
63 const ui::Event& event) { 62 const ui::Event& event) {
64 contents_view_->SetShowState( 63 contents_view_->SetShowState(
65 static_cast<ContentsView::ShowState>(sender->tag())); 64 static_cast<ContentsView::ShowState>(sender->tag()));
66 } 65 }
67 66
68 } // namespace app_list 67 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_main_view.cc ('k') | ui/app_list/views/contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698