| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 AddChildView(new ContentsSwitcherView(contents_view_)); | 106 AddChildView(new ContentsSwitcherView(contents_view_)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void AppListMainView::AddContentsView() { | 109 void AppListMainView::AddContentsView() { |
| 110 contents_view_ = new ContentsView( | 110 contents_view_ = new ContentsView( |
| 111 this, pagination_model_, model_, delegate_); | 111 this, pagination_model_, model_, delegate_); |
| 112 AddChildViewAt(contents_view_, kContentsViewIndex); | 112 AddChildViewAt(contents_view_, kContentsViewIndex); |
| 113 | 113 |
| 114 search_box_view_->set_contents_view(contents_view_); | 114 search_box_view_->set_contents_view(contents_view_); |
| 115 | 115 |
| 116 #if defined(USE_AURA) | |
| 117 contents_view_->SetPaintToLayer(true); | 116 contents_view_->SetPaintToLayer(true); |
| 118 contents_view_->SetFillsBoundsOpaquely(false); | 117 contents_view_->SetFillsBoundsOpaquely(false); |
| 119 contents_view_->layer()->SetMasksToBounds(true); | 118 contents_view_->layer()->SetMasksToBounds(true); |
| 120 #endif | |
| 121 } | 119 } |
| 122 | 120 |
| 123 AppListMainView::~AppListMainView() { | 121 AppListMainView::~AppListMainView() { |
| 124 pending_icon_loaders_.clear(); | 122 pending_icon_loaders_.clear(); |
| 125 } | 123 } |
| 126 | 124 |
| 127 void AppListMainView::ShowAppListWhenReady() { | 125 void AppListMainView::ShowAppListWhenReady() { |
| 128 if (pending_icon_loaders_.empty()) { | 126 if (pending_icon_loaders_.empty()) { |
| 129 icon_loading_wait_timer_.Stop(); | 127 icon_loading_wait_timer_.Stop(); |
| 130 GetWidget()->Show(); | 128 GetWidget()->Show(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 pending_icon_loaders_.begin(), pending_icon_loaders_.end(), loader); | 219 pending_icon_loaders_.begin(), pending_icon_loaders_.end(), loader); |
| 222 DCHECK(it != pending_icon_loaders_.end()); | 220 DCHECK(it != pending_icon_loaders_.end()); |
| 223 pending_icon_loaders_.erase(it); | 221 pending_icon_loaders_.erase(it); |
| 224 | 222 |
| 225 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { | 223 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { |
| 226 icon_loading_wait_timer_.Stop(); | 224 icon_loading_wait_timer_.Stop(); |
| 227 GetWidget()->Show(); | 225 GetWidget()->Show(); |
| 228 } | 226 } |
| 229 } | 227 } |
| 230 | 228 |
| 229 const char* AppListMainView::GetClassName() const { |
| 230 return "AppListMainView"; |
| 231 } |
| 232 |
| 231 void AppListMainView::ChildVisibilityChanged(views::View* child) { | 233 void AppListMainView::ChildVisibilityChanged(views::View* child) { |
| 232 // Repaint the AppListView's background which will repaint the background for | 234 // Repaint the AppListView's background which will repaint the background for |
| 233 // the search box. | 235 // the search box. |
| 234 if (child == search_box_view_ && parent()) | 236 if (child == search_box_view_ && parent()) |
| 235 parent()->SchedulePaint(); | 237 parent()->SchedulePaint(); |
| 236 } | 238 } |
| 237 | 239 |
| 238 void AppListMainView::ActivateApp(AppListItem* item, int event_flags) { | 240 void AppListMainView::ActivateApp(AppListItem* item, int event_flags) { |
| 239 // TODO(jennyz): Activate the folder via AppListModel notification. | 241 // TODO(jennyz): Activate the folder via AppListModel notification. |
| 240 if (item->GetItemType() == AppListFolderItem::kItemType) | 242 if (item->GetItemType() == AppListFolderItem::kItemType) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 271 // Resubmit the query via a posted task so that all observers for the | 273 // Resubmit the query via a posted task so that all observers for the |
| 272 // uninstall notification are notified. | 274 // uninstall notification are notified. |
| 273 base::MessageLoop::current()->PostTask( | 275 base::MessageLoop::current()->PostTask( |
| 274 FROM_HERE, | 276 FROM_HERE, |
| 275 base::Bind(&AppListMainView::QueryChanged, | 277 base::Bind(&AppListMainView::QueryChanged, |
| 276 weak_ptr_factory_.GetWeakPtr(), | 278 weak_ptr_factory_.GetWeakPtr(), |
| 277 search_box_view_)); | 279 search_box_view_)); |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace app_list | 282 } // namespace app_list |
| OLD | NEW |