| 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/views/apps_grid_view.h" | 5 #include "ui/app_list/views/apps_grid_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "ui/app_list/app_list_item_model.h" | 10 #include "ui/app_list/app_list_item_model.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 page_flip_delay_in_ms_(kPageFlipDelayInMs), | 251 page_flip_delay_in_ms_(kPageFlipDelayInMs), |
| 252 bounds_animator_(this) { | 252 bounds_animator_(this) { |
| 253 pagination_model_->AddObserver(this); | 253 pagination_model_->AddObserver(this); |
| 254 AddChildView(page_switcher_view_); | 254 AddChildView(page_switcher_view_); |
| 255 | 255 |
| 256 if (start_page_contents) { | 256 if (start_page_contents) { |
| 257 start_page_view_ = | 257 start_page_view_ = |
| 258 new views::WebView(start_page_contents->GetBrowserContext()); | 258 new views::WebView(start_page_contents->GetBrowserContext()); |
| 259 start_page_view_->SetWebContents(start_page_contents); | 259 start_page_view_->SetWebContents(start_page_contents); |
| 260 AddChildView(start_page_view_); | 260 AddChildView(start_page_view_); |
| 261 start_page_contents->GetWebUI()->CallJavascriptFunction( |
| 262 "appList.startPage.onAppListShown"); |
| 261 } | 263 } |
| 262 } | 264 } |
| 263 | 265 |
| 264 AppsGridView::~AppsGridView() { | 266 AppsGridView::~AppsGridView() { |
| 265 // Coming here |drag_view_| should already be canceled since otherwise the | 267 // Coming here |drag_view_| should already be canceled since otherwise the |
| 266 // drag would disappear after the app list got animated away and closed, | 268 // drag would disappear after the app list got animated away and closed, |
| 267 // which would look odd. | 269 // which would look odd. |
| 268 DCHECK(!drag_view_); | 270 DCHECK(!drag_view_); |
| 269 if (drag_view_) | 271 if (drag_view_) |
| 270 EndDrag(true); | 272 EndDrag(true); |
| 271 | 273 |
| 272 if (model_) | 274 if (model_) |
| 273 model_->RemoveObserver(this); | 275 model_->RemoveObserver(this); |
| 274 pagination_model_->RemoveObserver(this); | 276 pagination_model_->RemoveObserver(this); |
| 275 | 277 |
| 276 if (item_list_) | 278 if (item_list_) |
| 277 item_list_->RemoveObserver(this); | 279 item_list_->RemoveObserver(this); |
| 280 |
| 281 if (start_page_view_) { |
| 282 start_page_view_->GetWebContents()->GetWebUI()->CallJavascriptFunction( |
| 283 "appList.startPage.onAppListHidden"); |
| 284 } |
| 278 } | 285 } |
| 279 | 286 |
| 280 void AppsGridView::SetLayout(int icon_size, int cols, int rows_per_page) { | 287 void AppsGridView::SetLayout(int icon_size, int cols, int rows_per_page) { |
| 281 icon_size_.SetSize(icon_size, icon_size); | 288 icon_size_.SetSize(icon_size, icon_size); |
| 282 cols_ = cols; | 289 cols_ = cols; |
| 283 rows_per_page_ = rows_per_page; | 290 rows_per_page_ = rows_per_page; |
| 284 | 291 |
| 285 set_border(views::Border::CreateEmptyBorder(kTopPadding, | 292 set_border(views::Border::CreateEmptyBorder(kTopPadding, |
| 286 kLeftRightPadding, | 293 kLeftRightPadding, |
| 287 0, | 294 0, |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 #if defined(USE_AURA) | 1259 #if defined(USE_AURA) |
| 1253 ui::ScopedLayerAnimationSettings animator(view->layer()->GetAnimator()); | 1260 ui::ScopedLayerAnimationSettings animator(view->layer()->GetAnimator()); |
| 1254 animator.SetPreemptionStrategy( | 1261 animator.SetPreemptionStrategy( |
| 1255 immediate ? ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET : | 1262 immediate ? ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET : |
| 1256 ui::LayerAnimator::BLEND_WITH_CURRENT_ANIMATION); | 1263 ui::LayerAnimator::BLEND_WITH_CURRENT_ANIMATION); |
| 1257 view->layer()->SetOpacity(hide ? 0 : 1); | 1264 view->layer()->SetOpacity(hide ? 0 : 1); |
| 1258 #endif | 1265 #endif |
| 1259 } | 1266 } |
| 1260 | 1267 |
| 1261 } // namespace app_list | 1268 } // namespace app_list |
| OLD | NEW |