Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: ash/common/shelf/shelf_view.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: fix comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ash/common/shelf/shelf_view.h" 5 #include "ash/common/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 bounds_animator_->RemoveObserver(this); 398 bounds_animator_->RemoveObserver(this);
399 model_->RemoveObserver(this); 399 model_->RemoveObserver(this);
400 } 400 }
401 401
402 void ShelfView::Init() { 402 void ShelfView::Init() {
403 model_->AddObserver(this); 403 model_->AddObserver(this);
404 404
405 const ShelfItems& items(model_->items()); 405 const ShelfItems& items(model_->items());
406 for (ShelfItems::const_iterator i = items.begin(); i != items.end(); ++i) { 406 for (ShelfItems::const_iterator i = items.begin(); i != items.end(); ++i) {
407 views::View* child = CreateViewForItem(*i); 407 views::View* child = CreateViewForItem(*i);
408 child->SetPaintToLayer(true); 408 child->SetPaintToLayer();
409 view_model_->Add(child, static_cast<int>(i - items.begin())); 409 view_model_->Add(child, static_cast<int>(i - items.begin()));
410 AddChildView(child); 410 AddChildView(child);
411 } 411 }
412 overflow_button_ = new OverflowButton(this, wm_shelf_); 412 overflow_button_ = new OverflowButton(this, wm_shelf_);
413 overflow_button_->set_context_menu_controller(this); 413 overflow_button_->set_context_menu_controller(this);
414 ConfigureChildView(overflow_button_); 414 ConfigureChildView(overflow_button_);
415 AddChildView(overflow_button_); 415 AddChildView(overflow_button_);
416 416
417 // We'll layout when our bounds change. 417 // We'll layout when our bounds change.
418 } 418 }
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 if (SameDragType(model_->items()[i].type, type)) { 1385 if (SameDragType(model_->items()[i].type, type)) {
1386 if (min_index == -1) 1386 if (min_index == -1)
1387 min_index = i; 1387 min_index = i;
1388 max_index = i; 1388 max_index = i;
1389 } 1389 }
1390 } 1390 }
1391 return std::pair<int, int>(min_index, max_index); 1391 return std::pair<int, int>(min_index, max_index);
1392 } 1392 }
1393 1393
1394 void ShelfView::ConfigureChildView(views::View* view) { 1394 void ShelfView::ConfigureChildView(views::View* view) {
1395 view->SetPaintToLayer(true); 1395 view->SetPaintToLayer();
1396 view->layer()->SetFillsBoundsOpaquely(false); 1396 view->layer()->SetFillsBoundsOpaquely(false);
1397 } 1397 }
1398 1398
1399 void ShelfView::ToggleOverflowBubble() { 1399 void ShelfView::ToggleOverflowBubble() {
1400 if (IsShowingOverflowBubble()) { 1400 if (IsShowingOverflowBubble()) {
1401 overflow_bubble_->Hide(); 1401 overflow_bubble_->Hide();
1402 return; 1402 return;
1403 } 1403 }
1404 1404
1405 if (!overflow_bubble_) 1405 if (!overflow_bubble_)
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 1878
1879 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1879 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1880 const gfx::Rect bounds = GetBoundsInScreen(); 1880 const gfx::Rect bounds = GetBoundsInScreen();
1881 int distance = wm_shelf_->SelectValueForShelfAlignment( 1881 int distance = wm_shelf_->SelectValueForShelfAlignment(
1882 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1882 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1883 bounds.x() - coordinate.x()); 1883 bounds.x() - coordinate.x());
1884 return distance > 0 ? distance : 0; 1884 return distance > 0 ? distance : 0;
1885 } 1885 }
1886 1886
1887 } // namespace ash 1887 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698