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

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

Issue 578223002: Experimental app list: Enforce a 24-pixel padding on the top and sides. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ares-folder-heading-line-width
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_background.cc ('k') | ui/app_list/views/folder_header_view.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/app_list_main_view.h" 5 #include "ui/app_list/views/app_list_main_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 24 matching lines...) Expand all
35 namespace app_list { 35 namespace app_list {
36 36
37 namespace { 37 namespace {
38 38
39 // Border padding space around the bubble contents. 39 // Border padding space around the bubble contents.
40 const int kPadding = 1; 40 const int kPadding = 1;
41 41
42 // The maximum allowed time to wait for icon loading in milliseconds. 42 // The maximum allowed time to wait for icon loading in milliseconds.
43 const int kMaxIconLoadingWaitTimeInMs = 50; 43 const int kMaxIconLoadingWaitTimeInMs = 50;
44 44
45 // The padding around the search box in the experimental app list.
46 const int kSearchBoxViewPadding = 23;
47
48 // A view that holds another view and takes its preferred size. This is used for 45 // A view that holds another view and takes its preferred size. This is used for
49 // wrapping the search box view so it still gets laid out while hidden. This is 46 // wrapping the search box view so it still gets laid out while hidden. This is
50 // a separate class so it can notify the main view on search box visibility 47 // a separate class so it can notify the main view on search box visibility
51 // change. 48 // change.
52 class SearchBoxContainerView : public views::View { 49 class SearchBoxContainerView : public views::View {
53 public: 50 public:
54 SearchBoxContainerView(AppListMainView* host, SearchBoxView* search_box) 51 SearchBoxContainerView(AppListMainView* host, SearchBoxView* search_box)
55 : host_(host), search_box_(search_box) { 52 : host_(host), search_box_(search_box) {
56 SetLayoutManager(new views::FillLayout()); 53 SetLayoutManager(new views::FillLayout());
57 AddChildView(search_box); 54 AddChildView(search_box);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 108
112 AppListMainView::AppListMainView(AppListViewDelegate* delegate, 109 AppListMainView::AppListMainView(AppListViewDelegate* delegate,
113 int initial_apps_page, 110 int initial_apps_page,
114 gfx::NativeView parent) 111 gfx::NativeView parent)
115 : delegate_(delegate), 112 : delegate_(delegate),
116 model_(delegate->GetModel()), 113 model_(delegate->GetModel()),
117 search_box_view_(NULL), 114 search_box_view_(NULL),
118 contents_view_(NULL), 115 contents_view_(NULL),
119 contents_switcher_view_(NULL), 116 contents_switcher_view_(NULL),
120 weak_ptr_factory_(this) { 117 weak_ptr_factory_(this) {
121 SetLayoutManager( 118 SetBorder(
122 new views::BoxLayout(views::BoxLayout::kVertical, kPadding, kPadding, 0)); 119 views::Border::CreateEmptyBorder(kPadding, kPadding, kPadding, kPadding));
120 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
123 121
124 search_box_view_ = new SearchBoxView(this, delegate); 122 search_box_view_ = new SearchBoxView(this, delegate);
125 views::View* container = new SearchBoxContainerView(this, search_box_view_); 123 views::View* container = new SearchBoxContainerView(this, search_box_view_);
126 if (switches::IsExperimentalAppListEnabled()) { 124 if (switches::IsExperimentalAppListEnabled()) {
127 container->SetBorder( 125 container->SetBorder(
128 views::Border::CreateEmptyBorder(kSearchBoxViewPadding, 126 views::Border::CreateEmptyBorder(kExperimentalWindowPadding,
129 kSearchBoxViewPadding, 127 kExperimentalWindowPadding,
130 0, 128 0,
131 kSearchBoxViewPadding)); 129 kExperimentalWindowPadding));
132 } 130 }
133 AddChildView(container); 131 AddChildView(container);
134 AddContentsViews(); 132 AddContentsViews();
135 133
136 // Switch the apps grid view to the specified page. 134 // Switch the apps grid view to the specified page.
137 app_list::PaginationModel* pagination_model = GetAppsPaginationModel(); 135 app_list::PaginationModel* pagination_model = GetAppsPaginationModel();
138 if (pagination_model->is_valid_page(initial_apps_page)) 136 if (pagination_model->is_valid_page(initial_apps_page))
139 pagination_model->SelectPage(initial_apps_page, false); 137 pagination_model->SelectPage(initial_apps_page, false);
140 138
141 // Starts icon loading early. 139 // Starts icon loading early.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // Resubmit the query via a posted task so that all observers for the 340 // Resubmit the query via a posted task so that all observers for the
343 // uninstall notification are notified. 341 // uninstall notification are notified.
344 base::MessageLoop::current()->PostTask( 342 base::MessageLoop::current()->PostTask(
345 FROM_HERE, 343 FROM_HERE,
346 base::Bind(&AppListMainView::QueryChanged, 344 base::Bind(&AppListMainView::QueryChanged,
347 weak_ptr_factory_.GetWeakPtr(), 345 weak_ptr_factory_.GetWeakPtr(),
348 search_box_view_)); 346 search_box_view_));
349 } 347 }
350 348
351 } // namespace app_list 349 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_background.cc ('k') | ui/app_list/views/folder_header_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698