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_folder_view.h" | 5 #include "ui/app_list/views/app_list_folder_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 view_model_(new views::ViewModel), | 50 view_model_(new views::ViewModel), |
51 model_(model), | 51 model_(model), |
52 folder_item_(NULL), | 52 folder_item_(NULL), |
53 hide_for_reparent_(false) { | 53 hide_for_reparent_(false) { |
54 AddChildView(folder_header_view_); | 54 AddChildView(folder_header_view_); |
55 view_model_->Add(folder_header_view_, kIndexFolderHeader); | 55 view_model_->Add(folder_header_view_, kIndexFolderHeader); |
56 | 56 |
57 items_grid_view_ = new AppsGridView(app_list_main_view_); | 57 items_grid_view_ = new AppsGridView(app_list_main_view_); |
58 items_grid_view_->set_folder_delegate(this); | 58 items_grid_view_->set_folder_delegate(this); |
59 items_grid_view_->SetLayout( | 59 items_grid_view_->SetLayout( |
60 kPreferredIconDimension, | |
61 container_view->apps_grid_view()->cols(), | 60 container_view->apps_grid_view()->cols(), |
62 container_view->apps_grid_view()->rows_per_page()); | 61 container_view->apps_grid_view()->rows_per_page()); |
63 items_grid_view_->SetModel(model); | 62 items_grid_view_->SetModel(model); |
64 AddChildView(items_grid_view_); | 63 AddChildView(items_grid_view_); |
65 view_model_->Add(items_grid_view_, kIndexChildItems); | 64 view_model_->Add(items_grid_view_, kIndexChildItems); |
66 | 65 |
67 SetPaintToLayer(true); | 66 SetPaintToLayer(true); |
68 SetFillsBoundsOpaquely(false); | 67 SetFillsBoundsOpaquely(false); |
69 | 68 |
70 model_->AddObserver(this); | 69 model_->AddObserver(this); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 gfx::Rect AppListFolderView::GetItemIconBoundsAt(int index) { | 195 gfx::Rect AppListFolderView::GetItemIconBoundsAt(int index) { |
197 AppListItemView* item_view = items_grid_view_->GetItemViewAt(index); | 196 AppListItemView* item_view = items_grid_view_->GetItemViewAt(index); |
198 // Icon bounds relative to AppListItemView. | 197 // Icon bounds relative to AppListItemView. |
199 const gfx::Rect icon_bounds = item_view->GetIconBounds(); | 198 const gfx::Rect icon_bounds = item_view->GetIconBounds(); |
200 gfx::Rect to_apps_grid_view = item_view->ConvertRectToParent(icon_bounds); | 199 gfx::Rect to_apps_grid_view = item_view->ConvertRectToParent(icon_bounds); |
201 gfx::Rect to_folder = | 200 gfx::Rect to_folder = |
202 items_grid_view_->ConvertRectToParent(to_apps_grid_view); | 201 items_grid_view_->ConvertRectToParent(to_apps_grid_view); |
203 | 202 |
204 // Get the icon image's bound. | 203 // Get the icon image's bound. |
205 to_folder.ClampToCenteredSize( | 204 to_folder.ClampToCenteredSize( |
206 gfx::Size(kPreferredIconDimension, kPreferredIconDimension)); | 205 gfx::Size(kGridIconDimension, kGridIconDimension)); |
207 | 206 |
208 return to_folder; | 207 return to_folder; |
209 } | 208 } |
210 | 209 |
211 void AppListFolderView::UpdateFolderViewBackground(bool show_bubble) { | 210 void AppListFolderView::UpdateFolderViewBackground(bool show_bubble) { |
212 if (hide_for_reparent_) | 211 if (hide_for_reparent_) |
213 return; | 212 return; |
214 | 213 |
215 // Before showing the folder container inking bubble, hide the folder name. | 214 // Before showing the folder container inking bubble, hide the folder name. |
216 if (show_bubble) | 215 if (show_bubble) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 void AppListFolderView::GiveBackFocusToSearchBox() { | 312 void AppListFolderView::GiveBackFocusToSearchBox() { |
314 app_list_main_view_->search_box_view()->search_box()->RequestFocus(); | 313 app_list_main_view_->search_box_view()->search_box()->RequestFocus(); |
315 } | 314 } |
316 | 315 |
317 void AppListFolderView::SetItemName(AppListFolderItem* item, | 316 void AppListFolderView::SetItemName(AppListFolderItem* item, |
318 const std::string& name) { | 317 const std::string& name) { |
319 model_->SetItemName(item, name); | 318 model_->SetItemName(item, name); |
320 } | 319 } |
321 | 320 |
322 } // namespace app_list | 321 } // namespace app_list |
OLD | NEW |