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

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

Issue 45973003: ash: Rename LauncherIconObserver to ShelfIconObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('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/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"
11 #include "ash/drag_drop/drag_image_view.h" 11 #include "ash/drag_drop/drag_image_view.h"
12 #include "ash/launcher/launcher_button.h" 12 #include "ash/launcher/launcher_button.h"
13 #include "ash/launcher/launcher_delegate.h" 13 #include "ash/launcher/launcher_delegate.h"
14 #include "ash/launcher/launcher_icon_observer.h"
15 #include "ash/launcher/launcher_item_delegate.h" 14 #include "ash/launcher/launcher_item_delegate.h"
16 #include "ash/launcher/launcher_item_delegate_manager.h" 15 #include "ash/launcher/launcher_item_delegate_manager.h"
17 #include "ash/launcher/launcher_model.h" 16 #include "ash/launcher/launcher_model.h"
18 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
19 #include "ash/scoped_target_root_window.h" 18 #include "ash/scoped_target_root_window.h"
20 #include "ash/shelf/alternate_app_list_button.h" 19 #include "ash/shelf/alternate_app_list_button.h"
21 #include "ash/shelf/app_list_button.h" 20 #include "ash/shelf/app_list_button.h"
22 #include "ash/shelf/overflow_bubble.h" 21 #include "ash/shelf/overflow_bubble.h"
23 #include "ash/shelf/overflow_button.h" 22 #include "ash/shelf/overflow_button.h"
23 #include "ash/shelf/shelf_icon_observer.h"
24 #include "ash/shelf/shelf_layout_manager.h" 24 #include "ash/shelf/shelf_layout_manager.h"
25 #include "ash/shelf/shelf_tooltip_manager.h" 25 #include "ash/shelf/shelf_tooltip_manager.h"
26 #include "ash/shelf/shelf_widget.h" 26 #include "ash/shelf/shelf_widget.h"
27 #include "ash/shell_delegate.h" 27 #include "ash/shell_delegate.h"
28 #include "base/auto_reset.h" 28 #include "base/auto_reset.h"
29 #include "base/memory/scoped_ptr.h" 29 #include "base/memory/scoped_ptr.h"
30 #include "grit/ash_resources.h" 30 #include "grit/ash_resources.h"
31 #include "grit/ash_strings.h" 31 #include "grit/ash_strings.h"
32 #include "ui/aura/client/screen_position_client.h" 32 #include "ui/aura/client/screen_position_client.h"
33 #include "ui/aura/root_window.h" 33 #include "ui/aura/root_window.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 int index = model_->FirstPanelIndex(); 870 int index = model_->FirstPanelIndex();
871 while (index < view_model_->view_size() && 871 while (index < view_model_->view_size() &&
872 layout_manager_->PrimaryAxisValue( 872 layout_manager_->PrimaryAxisValue(
873 view_model_->ideal_bounds(index).right(), 873 view_model_->ideal_bounds(index).right(),
874 view_model_->ideal_bounds(index).bottom()) < min_value) { 874 view_model_->ideal_bounds(index).bottom()) < min_value) {
875 ++index; 875 ++index;
876 } 876 }
877 return index; 877 return index;
878 } 878 }
879 879
880 void ShelfView::AddIconObserver(LauncherIconObserver* observer) { 880 void ShelfView::AddIconObserver(ShelfIconObserver* observer) {
881 observers_.AddObserver(observer); 881 observers_.AddObserver(observer);
882 } 882 }
883 883
884 void ShelfView::RemoveIconObserver(LauncherIconObserver* observer) { 884 void ShelfView::RemoveIconObserver(ShelfIconObserver* observer) {
885 observers_.RemoveObserver(observer); 885 observers_.RemoveObserver(observer);
886 } 886 }
887 887
888 void ShelfView::AnimateToIdealBounds() { 888 void ShelfView::AnimateToIdealBounds() {
889 IdealBounds ideal_bounds; 889 IdealBounds ideal_bounds;
890 CalculateIdealBounds(&ideal_bounds); 890 CalculateIdealBounds(&ideal_bounds);
891 for (int i = 0; i < view_model_->view_size(); ++i) { 891 for (int i = 0; i < view_model_->view_size(); ++i) {
892 View* view = view_model_->view_at(i); 892 View* view = view_model_->view_at(i);
893 bounds_animator_->AnimateViewTo(view, view_model_->ideal_bounds(i)); 893 bounds_animator_->AnimateViewTo(view, view_model_->ideal_bounds(i));
894 // Now that the item animation starts, we have to make sure that the 894 // Now that the item animation starts, we have to make sure that the
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 return gfx::Size(last_button_bounds.right() + leading_inset_, 1348 return gfx::Size(last_button_bounds.right() + leading_inset_,
1349 preferred_size); 1349 preferred_size);
1350 } 1350 }
1351 1351
1352 return gfx::Size(preferred_size, 1352 return gfx::Size(preferred_size,
1353 last_button_bounds.bottom() + leading_inset_); 1353 last_button_bounds.bottom() + leading_inset_);
1354 } 1354 }
1355 1355
1356 void ShelfView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 1356 void ShelfView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
1357 LayoutToIdealBounds(); 1357 LayoutToIdealBounds();
1358 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, 1358 FOR_EACH_OBSERVER(ShelfIconObserver, observers_,
1359 OnLauncherIconPositionsChanged()); 1359 OnShelfIconPositionsChanged());
1360 1360
1361 if (IsShowingOverflowBubble()) 1361 if (IsShowingOverflowBubble())
1362 overflow_bubble_->Hide(); 1362 overflow_bubble_->Hide();
1363 } 1363 }
1364 1364
1365 views::FocusTraversable* ShelfView::GetPaneFocusTraversable() { 1365 views::FocusTraversable* ShelfView::GetPaneFocusTraversable() {
1366 return this; 1366 return this;
1367 } 1367 }
1368 1368
1369 void ShelfView::GetAccessibleState(ui::AccessibleViewState* state) { 1369 void ShelfView::GetAccessibleState(ui::AccessibleViewState* state) {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 owner_overflow_bubble_->HideBubbleAndRefreshButton(); 1797 owner_overflow_bubble_->HideBubbleAndRefreshButton();
1798 1798
1799 // Unpinning an item will reset the |launcher_menu_runner_| before coming 1799 // Unpinning an item will reset the |launcher_menu_runner_| before coming
1800 // here. 1800 // here.
1801 if (launcher_menu_runner_) 1801 if (launcher_menu_runner_)
1802 closing_event_time_ = launcher_menu_runner_->closing_event_time(); 1802 closing_event_time_ = launcher_menu_runner_->closing_event_time();
1803 Shell::GetInstance()->UpdateShelfVisibility(); 1803 Shell::GetInstance()->UpdateShelfVisibility();
1804 } 1804 }
1805 1805
1806 void ShelfView::OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) { 1806 void ShelfView::OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) {
1807 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, 1807 FOR_EACH_OBSERVER(ShelfIconObserver, observers_,
1808 OnLauncherIconPositionsChanged()); 1808 OnShelfIconPositionsChanged());
1809 PreferredSizeChanged(); 1809 PreferredSizeChanged();
1810 } 1810 }
1811 1811
1812 void ShelfView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { 1812 void ShelfView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
1813 if (snap_back_from_rip_off_view_ && animator == bounds_animator_) { 1813 if (snap_back_from_rip_off_view_ && animator == bounds_animator_) {
1814 if (!animator->IsAnimating(snap_back_from_rip_off_view_)) { 1814 if (!animator->IsAnimating(snap_back_from_rip_off_view_)) {
1815 // Coming here the animation of the LauncherButton is finished and the 1815 // Coming here the animation of the LauncherButton is finished and the
1816 // previously hidden status can be shown again. Since the button itself 1816 // previously hidden status can be shown again. Since the button itself
1817 // might have gone away or changed locations we check that the button 1817 // might have gone away or changed locations we check that the button
1818 // is still in the shelf and show its status again. 1818 // is still in the shelf and show its status again.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 break; 1879 break;
1880 case ash::SHELF_ALIGNMENT_TOP: 1880 case ash::SHELF_ALIGNMENT_TOP:
1881 distance = coordinate.y() - bounds.bottom(); 1881 distance = coordinate.y() - bounds.bottom();
1882 break; 1882 break;
1883 } 1883 }
1884 return distance > 0 ? distance : 0; 1884 return distance > 0 ? distance : 0;
1885 } 1885 }
1886 1886
1887 } // namespace internal 1887 } // namespace internal
1888 } // namespace ash 1888 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698