OLD | NEW |
---|---|
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 18 matching lines...) Expand all Loading... | |
29 #include "ui/views/border.h" | 29 #include "ui/views/border.h" |
30 #include "ui/views/controls/textfield/textfield.h" | 30 #include "ui/views/controls/textfield/textfield.h" |
31 #include "ui/views/layout/box_layout.h" | 31 #include "ui/views/layout/box_layout.h" |
32 #include "ui/views/layout/fill_layout.h" | 32 #include "ui/views/layout/fill_layout.h" |
33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
34 | 34 |
35 namespace app_list { | 35 namespace app_list { |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 // Border padding space around the bubble contents. | |
40 const int kPadding = 1; | |
41 | |
42 // The maximum allowed time to wait for icon loading in milliseconds. | 39 // The maximum allowed time to wait for icon loading in milliseconds. |
43 const int kMaxIconLoadingWaitTimeInMs = 50; | 40 const int kMaxIconLoadingWaitTimeInMs = 50; |
44 | 41 |
45 // A view that holds another view and takes its preferred size. This is used for | 42 // A view that holds another view and takes its preferred size. This is used for |
46 // wrapping the search box view so it still gets laid out while hidden. This is | 43 // wrapping the search box view so it still gets laid out while hidden. This is |
47 // a separate class so it can notify the main view on search box visibility | 44 // a separate class so it can notify the main view on search box visibility |
48 // change. | 45 // change. |
49 class SearchBoxContainerView : public views::View { | 46 class SearchBoxContainerView : public views::View { |
50 public: | 47 public: |
51 SearchBoxContainerView(AppListMainView* host, SearchBoxView* search_box) | 48 SearchBoxContainerView(AppListMainView* host, SearchBoxView* search_box) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 //////////////////////////////////////////////////////////////////////////////// | 103 //////////////////////////////////////////////////////////////////////////////// |
107 // AppListMainView: | 104 // AppListMainView: |
108 | 105 |
109 AppListMainView::AppListMainView(AppListViewDelegate* delegate) | 106 AppListMainView::AppListMainView(AppListViewDelegate* delegate) |
110 : delegate_(delegate), | 107 : delegate_(delegate), |
111 model_(delegate->GetModel()), | 108 model_(delegate->GetModel()), |
112 search_box_view_(NULL), | 109 search_box_view_(NULL), |
113 contents_view_(NULL), | 110 contents_view_(NULL), |
114 contents_switcher_view_(NULL), | 111 contents_switcher_view_(NULL), |
115 weak_ptr_factory_(this) { | 112 weak_ptr_factory_(this) { |
116 SetBorder( | 113 SetLayoutManager( |
117 views::Border::CreateEmptyBorder(kPadding, kPadding, kPadding, kPadding)); | 114 new views::BoxLayout(views::BoxLayout::kVertical, |
118 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 115 0, |
116 0, | |
117 switches::IsExperimentalAppListEnabled() ? 0 : 1)); | |
Matt Giuca
2014/10/23 05:16:34
I don't get why you added child spacing here.
calamity
2014/10/23 05:50:35
Compensates for the separator line. The contents v
| |
119 | 118 |
120 search_box_view_ = new SearchBoxView(this, delegate); | 119 search_box_view_ = new SearchBoxView(this, delegate); |
121 views::View* container = new SearchBoxContainerView(this, search_box_view_); | 120 views::View* container = new SearchBoxContainerView(this, search_box_view_); |
122 if (switches::IsExperimentalAppListEnabled()) { | 121 if (switches::IsExperimentalAppListEnabled()) { |
123 container->SetBorder( | 122 container->SetBorder( |
124 views::Border::CreateEmptyBorder(kExperimentalWindowPadding, | 123 views::Border::CreateEmptyBorder(kExperimentalWindowPadding, |
125 kExperimentalWindowPadding, | 124 kExperimentalWindowPadding, |
126 0, | 125 0, |
127 kExperimentalWindowPadding)); | 126 kExperimentalWindowPadding)); |
128 } | 127 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 // 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 |
342 // uninstall notification are notified. | 341 // uninstall notification are notified. |
343 base::MessageLoop::current()->PostTask( | 342 base::MessageLoop::current()->PostTask( |
344 FROM_HERE, | 343 FROM_HERE, |
345 base::Bind(&AppListMainView::QueryChanged, | 344 base::Bind(&AppListMainView::QueryChanged, |
346 weak_ptr_factory_.GetWeakPtr(), | 345 weak_ptr_factory_.GetWeakPtr(), |
347 search_box_view_)); | 346 search_box_view_)); |
348 } | 347 } |
349 | 348 |
350 } // namespace app_list | 349 } // namespace app_list |
OLD | NEW |