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

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

Issue 2627533002: Replace ShelfItemDelegate::GetTitle() with ShelfItem::title. (Closed)
Patch Set: Address 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
« no previous file with comments | « ash/common/shelf/shelf_model.cc ('k') | ash/common/shelf/shelf_window_watcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 bool ShelfView::ShouldShowTooltipForView(const views::View* view) const { 520 bool ShelfView::ShouldShowTooltipForView(const views::View* view) const {
521 // TODO(msw): Push this app list state into ShelfItem::shows_tooltip. 521 // TODO(msw): Push this app list state into ShelfItem::shows_tooltip.
522 if (view == GetAppListButton() && GetAppListButton()->is_showing_app_list()) 522 if (view == GetAppListButton() && GetAppListButton()->is_showing_app_list())
523 return false; 523 return false;
524 const ShelfItem* item = ShelfItemForView(view); 524 const ShelfItem* item = ShelfItemForView(view);
525 return item && item->shows_tooltip; 525 return item && item->shows_tooltip;
526 } 526 }
527 527
528 base::string16 ShelfView::GetTitleForView(const views::View* view) const { 528 base::string16 ShelfView::GetTitleForView(const views::View* view) const {
529 const ShelfItem* item = ShelfItemForView(view); 529 const ShelfItem* item = ShelfItemForView(view);
530 if (!item || !model_->GetShelfItemDelegate(item->id)) 530 return item ? item->title : base::string16();
531 return base::string16();
532 return model_->GetShelfItemDelegate(item->id)->GetTitle();
533 } 531 }
534 532
535 gfx::Rect ShelfView::GetVisibleItemsBoundsInScreen() { 533 gfx::Rect ShelfView::GetVisibleItemsBoundsInScreen() {
536 gfx::Size preferred_size = GetPreferredSize(); 534 gfx::Size preferred_size = GetPreferredSize();
537 gfx::Point origin(GetMirroredXWithWidthInView(0, preferred_size.width()), 0); 535 gfx::Point origin(GetMirroredXWithWidthInView(0, preferred_size.width()), 0);
538 ConvertPointToScreen(this, &origin); 536 ConvertPointToScreen(this, &origin);
539 return gfx::Rect(origin, preferred_size); 537 return gfx::Rect(origin, preferred_size);
540 } 538 }
541 539
542 void ShelfView::ButtonPressed(views::Button* sender, 540 void ShelfView::ButtonPressed(views::Button* sender,
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 1878
1881 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1879 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1882 const gfx::Rect bounds = GetBoundsInScreen(); 1880 const gfx::Rect bounds = GetBoundsInScreen();
1883 int distance = wm_shelf_->SelectValueForShelfAlignment( 1881 int distance = wm_shelf_->SelectValueForShelfAlignment(
1884 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1882 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1885 bounds.x() - coordinate.x()); 1883 bounds.x() - coordinate.x());
1886 return distance > 0 ? distance : 0; 1884 return distance > 0 ? distance : 0;
1887 } 1885 }
1888 1886
1889 } // namespace ash 1887 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_model.cc ('k') | ash/common/shelf/shelf_window_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698