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

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

Issue 152223002: Renames LauncherID, LauncherItem and LauncherItems... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OWNERS Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/app_list_shelf_item_delegate.cc ('k') | ash/shelf/shelf_button.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.h" 5 #include "ash/shelf/shelf.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "ash/focus_cycler.h" 10 #include "ash/focus_cycler.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return shelf_widget ? shelf_widget->shelf() : NULL; 75 return shelf_widget ? shelf_widget->shelf() : NULL;
76 } 76 }
77 77
78 void Shelf::SetAlignment(ShelfAlignment alignment) { 78 void Shelf::SetAlignment(ShelfAlignment alignment) {
79 alignment_ = alignment; 79 alignment_ = alignment;
80 shelf_view_->OnShelfAlignmentChanged(); 80 shelf_view_->OnShelfAlignmentChanged();
81 // ShelfLayoutManager will resize the shelf. 81 // ShelfLayoutManager will resize the shelf.
82 } 82 }
83 83
84 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(aura::Window* window) { 84 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(aura::Window* window) {
85 LauncherID id = GetLauncherIDForWindow(window); 85 ShelfID id = GetShelfIDForWindow(window);
86 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); 86 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id));
87 gfx::Point screen_origin; 87 gfx::Point screen_origin;
88 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); 88 views::View::ConvertPointToScreen(shelf_view_, &screen_origin);
89 return gfx::Rect(screen_origin.x() + bounds.x(), 89 return gfx::Rect(screen_origin.x() + bounds.x(),
90 screen_origin.y() + bounds.y(), 90 screen_origin.y() + bounds.y(),
91 bounds.width(), 91 bounds.width(),
92 bounds.height()); 92 bounds.height());
93 } 93 }
94 94
95 void Shelf::UpdateIconPositionForWindow(aura::Window* window) { 95 void Shelf::UpdateIconPositionForWindow(aura::Window* window) {
96 shelf_view_->UpdatePanelIconPosition( 96 shelf_view_->UpdatePanelIconPosition(
97 GetLauncherIDForWindow(window), 97 GetShelfIDForWindow(window),
98 ScreenUtil::ConvertRectFromScreen( 98 ScreenUtil::ConvertRectFromScreen(
99 shelf_widget()->GetNativeView(), 99 shelf_widget()->GetNativeView(),
100 window->GetBoundsInScreen()).CenterPoint()); 100 window->GetBoundsInScreen()).CenterPoint());
101 } 101 }
102 102
103 void Shelf::ActivateShelfItem(int index) { 103 void Shelf::ActivateShelfItem(int index) {
104 // We pass in a keyboard event which will then trigger a switch to the 104 // We pass in a keyboard event which will then trigger a switch to the
105 // next item if the current one is already active. 105 // next item if the current one is already active.
106 ui::KeyEvent event(ui::ET_KEY_RELEASED, 106 ui::KeyEvent event(ui::ET_KEY_RELEASED,
107 ui::VKEY_UNKNOWN, // The actual key gets ignored. 107 ui::VKEY_UNKNOWN, // The actual key gets ignored.
108 ui::EF_NONE, 108 ui::EF_NONE,
109 false); 109 false);
110 110
111 const LauncherItem& item = shelf_view_->model()->items()[index]; 111 const ShelfItem& item = shelf_view_->model()->items()[index];
112 ShelfItemDelegate* item_delegate = 112 ShelfItemDelegate* item_delegate =
113 Shell::GetInstance()->shelf_item_delegate_manager()->GetShelfItemDelegate( 113 Shell::GetInstance()->shelf_item_delegate_manager()->GetShelfItemDelegate(
114 item.id); 114 item.id);
115 item_delegate->ItemSelected(event); 115 item_delegate->ItemSelected(event);
116 } 116 }
117 117
118 void Shelf::CycleWindowLinear(CycleDirection direction) { 118 void Shelf::CycleWindowLinear(CycleDirection direction) {
119 int item_index = GetNextActivatedItemIndex( 119 int item_index = GetNextActivatedItemIndex(
120 *(shelf_view_->model()), direction); 120 *(shelf_view_->model()), direction);
121 if (item_index >= 0) 121 if (item_index >= 0)
(...skipping 27 matching lines...) Expand all
149 void Shelf::SchedulePaint() { 149 void Shelf::SchedulePaint() {
150 shelf_view_->SchedulePaintForAllButtons(); 150 shelf_view_->SchedulePaintForAllButtons();
151 } 151 }
152 152
153 views::View* Shelf::GetAppListButtonView() const { 153 views::View* Shelf::GetAppListButtonView() const {
154 return shelf_view_->GetAppListButtonView(); 154 return shelf_view_->GetAppListButtonView();
155 } 155 }
156 156
157 void Shelf::LaunchAppIndexAt(int item_index) { 157 void Shelf::LaunchAppIndexAt(int item_index) {
158 ShelfModel* shelf_model = shelf_view_->model(); 158 ShelfModel* shelf_model = shelf_view_->model();
159 const LauncherItems& items = shelf_model->items(); 159 const ShelfItems& items = shelf_model->items();
160 int item_count = shelf_model->item_count(); 160 int item_count = shelf_model->item_count();
161 int indexes_left = item_index >= 0 ? item_index : item_count; 161 int indexes_left = item_index >= 0 ? item_index : item_count;
162 int found_index = -1; 162 int found_index = -1;
163 163
164 // Iterating until we have hit the index we are interested in which 164 // Iterating until we have hit the index we are interested in which
165 // is true once indexes_left becomes negative. 165 // is true once indexes_left becomes negative.
166 for (int i = 0; i < item_count && indexes_left >= 0; i++) { 166 for (int i = 0; i < item_count && indexes_left >= 0; i++) {
167 if (items[i].type != TYPE_APP_LIST) { 167 if (items[i].type != TYPE_APP_LIST) {
168 found_index = i; 168 found_index = i;
169 indexes_left--; 169 indexes_left--;
(...skipping 19 matching lines...) Expand all
189 189
190 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { 190 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const {
191 return shelf_view_->GetVisibleItemsBoundsInScreen(); 191 return shelf_view_->GetVisibleItemsBoundsInScreen();
192 } 192 }
193 193
194 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { 194 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() {
195 return shelf_view_; 195 return shelf_view_;
196 } 196 }
197 197
198 } // namespace ash 198 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/app_list_shelf_item_delegate.cc ('k') | ash/shelf/shelf_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698