| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |