OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/app_list_view.h" | 5 #include "ui/app_list/app_list_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ui/app_list/app_list_bubble_border.h" | 9 #include "ui/app_list/app_list_bubble_border.h" |
10 #include "ui/app_list/app_list_item_view.h" | 10 #include "ui/app_list/app_list_item_view.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace { | 27 namespace { |
28 | 28 |
29 // 0.2 black | 29 // 0.2 black |
30 const SkColor kWidgetBackgroundColor = SkColorSetARGB(0x33, 0, 0, 0); | 30 const SkColor kWidgetBackgroundColor = SkColorSetARGB(0x33, 0, 0, 0); |
31 | 31 |
32 const float kModelViewAnimationScaleFactor = 0.9f; | 32 const float kModelViewAnimationScaleFactor = 0.9f; |
33 | 33 |
34 const int kPreferredIconDimension = 48; | 34 const int kPreferredIconDimension = 48; |
35 const int kPreferredCols = 4; | 35 const int kPreferredCols = 4; |
36 const int kPreferredRows = 4; | 36 const int kPreferredRows = 4; |
37 // Padding space in pixels between model view and page switcher footer. | |
38 const int kModelViewFooterPadding = 10; | |
39 | 37 |
40 ui::Transform GetScaleTransform(AppListModelView* model_view) { | 38 ui::Transform GetScaleTransform(AppListModelView* model_view) { |
41 gfx::Rect pixel_bounds = model_view->GetLayerBoundsInPixel(); | 39 gfx::Rect pixel_bounds = model_view->GetLayerBoundsInPixel(); |
42 gfx::Point center(pixel_bounds.width() / 2, pixel_bounds.height() / 2); | 40 gfx::Point center(pixel_bounds.width() / 2, pixel_bounds.height() / 2); |
43 return ui::GetScaleTransform(center, kModelViewAnimationScaleFactor); | 41 return ui::GetScaleTransform(center, kModelViewAnimationScaleFactor); |
44 } | 42 } |
45 | 43 |
46 } // namespace | 44 } // namespace |
47 | 45 |
48 //////////////////////////////////////////////////////////////////////////////// | 46 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 88 |
91 // Sets initial transform. AnimateShow changes it back to identity transform. | 89 // Sets initial transform. AnimateShow changes it back to identity transform. |
92 model_view_->SetTransform(GetScaleTransform(model_view_)); | 90 model_view_->SetTransform(GetScaleTransform(model_view_)); |
93 UpdateModel(); | 91 UpdateModel(); |
94 } | 92 } |
95 | 93 |
96 void AppListView::InitAsBubble(gfx::NativeView parent, views::View* anchor) { | 94 void AppListView::InitAsBubble(gfx::NativeView parent, views::View* anchor) { |
97 bubble_style_ = true; | 95 bubble_style_ = true; |
98 set_background(NULL); | 96 set_background(NULL); |
99 | 97 |
100 SetLayoutManager(new views::BoxLayout( | 98 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
101 views::BoxLayout::kVertical, 0, 0, kModelViewFooterPadding)); | |
102 | 99 |
103 model_view_ = new AppListModelView(this, pagination_model_.get()); | 100 model_view_ = new AppListModelView(this, pagination_model_.get()); |
104 model_view_->SetLayout(kPreferredIconDimension, | 101 model_view_->SetLayout(kPreferredIconDimension, |
105 kPreferredCols, | 102 kPreferredCols, |
106 kPreferredRows); | 103 kPreferredRows); |
107 AddChildView(model_view_); | 104 AddChildView(model_view_); |
108 | 105 |
109 PageSwitcher* page_switcher = new PageSwitcher(pagination_model_.get()); | 106 PageSwitcher* page_switcher = new PageSwitcher(pagination_model_.get()); |
110 AddChildView(page_switcher); | 107 AddChildView(page_switcher); |
111 | 108 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 bubble_border_->set_arrow_offset(-offset); | 262 bubble_border_->set_arrow_offset(-offset); |
266 | 263 |
267 // Repaints border if arrow offset is changed. | 264 // Repaints border if arrow offset is changed. |
268 if (bubble_border_->arrow_offset() != old_arrow_offset) | 265 if (bubble_border_->arrow_offset() != old_arrow_offset) |
269 GetBubbleFrameView()->SchedulePaint(); | 266 GetBubbleFrameView()->SchedulePaint(); |
270 | 267 |
271 return bubble_rect; | 268 return bubble_rect; |
272 } | 269 } |
273 | 270 |
274 } // namespace app_list | 271 } // namespace app_list |
OLD | NEW |