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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return false; | 535 return false; |
536 } | 536 } |
537 const ShelfItem* item = ShelfItemForView(view); | 537 const ShelfItem* item = ShelfItemForView(view); |
538 if (!item) | 538 if (!item) |
539 return false; | 539 return false; |
540 return item_manager_->GetShelfItemDelegate(item->id)->ShouldShowTooltip(); | 540 return item_manager_->GetShelfItemDelegate(item->id)->ShouldShowTooltip(); |
541 } | 541 } |
542 | 542 |
543 base::string16 ShelfView::GetTitleForView(const views::View* view) const { | 543 base::string16 ShelfView::GetTitleForView(const views::View* view) const { |
544 const ShelfItem* item = ShelfItemForView(view); | 544 const ShelfItem* item = ShelfItemForView(view); |
545 if (!item) | 545 if (!item || !item_manager_->GetShelfItemDelegate(item->id)) |
546 return base::string16(); | 546 return base::string16(); |
547 return item_manager_->GetShelfItemDelegate(item->id)->GetTitle(); | 547 return item_manager_->GetShelfItemDelegate(item->id)->GetTitle(); |
548 } | 548 } |
549 | 549 |
550 gfx::Rect ShelfView::GetVisibleItemsBoundsInScreen() { | 550 gfx::Rect ShelfView::GetVisibleItemsBoundsInScreen() { |
551 gfx::Size preferred_size = GetPreferredSize(); | 551 gfx::Size preferred_size = GetPreferredSize(); |
552 gfx::Point origin(GetMirroredXWithWidthInView(0, preferred_size.width()), 0); | 552 gfx::Point origin(GetMirroredXWithWidthInView(0, preferred_size.width()), 0); |
553 ConvertPointToScreen(this, &origin); | 553 ConvertPointToScreen(this, &origin); |
554 return gfx::Rect(origin, preferred_size); | 554 return gfx::Rect(origin, preferred_size); |
555 } | 555 } |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 | 1887 |
1888 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1888 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
1889 const gfx::Rect bounds = GetBoundsInScreen(); | 1889 const gfx::Rect bounds = GetBoundsInScreen(); |
1890 int distance = shelf_->SelectValueForShelfAlignment( | 1890 int distance = shelf_->SelectValueForShelfAlignment( |
1891 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1891 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
1892 bounds.x() - coordinate.x()); | 1892 bounds.x() - coordinate.x()); |
1893 return distance > 0 ? distance : 0; | 1893 return distance > 0 ? distance : 0; |
1894 } | 1894 } |
1895 | 1895 |
1896 } // namespace ash | 1896 } // namespace ash |
OLD | NEW |