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

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

Issue 1659283002: ash: Explicitly teach various components about ShelfLayoutManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ozone-ui-event-platform-event
Patch Set: . Created 4 years, 10 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/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 void ShelfView::Init() { 414 void ShelfView::Init() {
415 model_->AddObserver(this); 415 model_->AddObserver(this);
416 416
417 const ShelfItems& items(model_->items()); 417 const ShelfItems& items(model_->items());
418 for (ShelfItems::const_iterator i = items.begin(); i != items.end(); ++i) { 418 for (ShelfItems::const_iterator i = items.begin(); i != items.end(); ++i) {
419 views::View* child = CreateViewForItem(*i); 419 views::View* child = CreateViewForItem(*i);
420 child->SetPaintToLayer(true); 420 child->SetPaintToLayer(true);
421 view_model_->Add(child, static_cast<int>(i - items.begin())); 421 view_model_->Add(child, static_cast<int>(i - items.begin()));
422 AddChildView(child); 422 AddChildView(child);
423 } 423 }
424 overflow_button_ = new OverflowButton(this); 424 overflow_button_ = new OverflowButton(this, shelf_layout_manager());
425 overflow_button_->set_context_menu_controller(this); 425 overflow_button_->set_context_menu_controller(this);
426 ConfigureChildView(overflow_button_); 426 ConfigureChildView(overflow_button_);
427 AddChildView(overflow_button_); 427 AddChildView(overflow_button_);
428 428
429 // We'll layout when our bounds change. 429 // We'll layout when our bounds change.
430 } 430 }
431 431
432 void ShelfView::OnShelfAlignmentChanged() { 432 void ShelfView::OnShelfAlignmentChanged() {
433 overflow_button_->OnShelfAlignmentChanged(); 433 overflow_button_->OnShelfAlignmentChanged();
434 LayoutToIdealBounds(); 434 LayoutToIdealBounds();
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 distance = bounds.x() - coordinate.x(); 1983 distance = bounds.x() - coordinate.x();
1984 break; 1984 break;
1985 case SHELF_ALIGNMENT_TOP: 1985 case SHELF_ALIGNMENT_TOP:
1986 distance = coordinate.y() - bounds.bottom(); 1986 distance = coordinate.y() - bounds.bottom();
1987 break; 1987 break;
1988 } 1988 }
1989 return distance > 0 ? distance : 0; 1989 return distance > 0 ? distance : 0;
1990 } 1990 }
1991 1991
1992 } // namespace ash 1992 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698