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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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/aura/wm_window_aura.h" 10 #include "ash/aura/wm_window_aura.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return shelf_widget_->shelf_layout_manager()->visibility_state(); 112 return shelf_widget_->shelf_layout_manager()->visibility_state();
113 } 113 }
114 114
115 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow( 115 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(
116 const aura::Window* window) { 116 const aura::Window* window) {
117 ShelfID id = GetShelfIDForWindow(window); 117 ShelfID id = GetShelfIDForWindow(window);
118 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); 118 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id));
119 gfx::Point screen_origin; 119 gfx::Point screen_origin;
120 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); 120 views::View::ConvertPointToScreen(shelf_view_, &screen_origin);
121 return gfx::Rect(screen_origin.x() + bounds.x(), 121 return gfx::Rect(screen_origin.x() + bounds.x(),
122 screen_origin.y() + bounds.y(), 122 screen_origin.y() + bounds.y(), bounds.width(),
123 bounds.width(),
124 bounds.height()); 123 bounds.height());
125 } 124 }
126 125
127 void Shelf::UpdateIconPositionForWindow(aura::Window* window) { 126 void Shelf::UpdateIconPositionForWindow(aura::Window* window) {
128 shelf_view_->UpdatePanelIconPosition( 127 shelf_view_->UpdatePanelIconPosition(
129 GetShelfIDForWindow(window), 128 GetShelfIDForWindow(window),
130 ScreenUtil::ConvertRectFromScreen( 129 ScreenUtil::ConvertRectFromScreen(shelf_widget()->GetNativeView(),
131 shelf_widget()->GetNativeView(), 130 window->GetBoundsInScreen())
132 window->GetBoundsInScreen()).CenterPoint()); 131 .CenterPoint());
133 } 132 }
134 133
135 void Shelf::ActivateShelfItem(int index) { 134 void Shelf::ActivateShelfItem(int index) {
136 // We pass in a keyboard event which will then trigger a switch to the 135 // We pass in a keyboard event which will then trigger a switch to the
137 // next item if the current one is already active. 136 // next item if the current one is already active.
138 ui::KeyEvent event(ui::ET_KEY_RELEASED, 137 ui::KeyEvent event(ui::ET_KEY_RELEASED,
139 ui::VKEY_UNKNOWN, // The actual key gets ignored. 138 ui::VKEY_UNKNOWN, // The actual key gets ignored.
140 ui::EF_NONE); 139 ui::EF_NONE);
141 140
142 const ShelfItem& item = shelf_view_->model()->items()[index]; 141 const ShelfItem& item = shelf_view_->model()->items()[index];
143 ShelfItemDelegate* item_delegate = 142 ShelfItemDelegate* item_delegate =
144 Shell::GetInstance()->shelf_item_delegate_manager()->GetShelfItemDelegate( 143 Shell::GetInstance()->shelf_item_delegate_manager()->GetShelfItemDelegate(
145 item.id); 144 item.id);
146 item_delegate->ItemSelected(event); 145 item_delegate->ItemSelected(event);
147 } 146 }
148 147
149 void Shelf::CycleWindowLinear(CycleDirection direction) { 148 void Shelf::CycleWindowLinear(CycleDirection direction) {
150 int item_index = GetNextActivatedItemIndex( 149 int item_index =
151 *(shelf_view_->model()), direction); 150 GetNextActivatedItemIndex(*(shelf_view_->model()), direction);
152 if (item_index >= 0) 151 if (item_index >= 0)
153 ActivateShelfItem(item_index); 152 ActivateShelfItem(item_index);
154 } 153 }
155 154
156 void Shelf::AddIconObserver(ShelfIconObserver* observer) { 155 void Shelf::AddIconObserver(ShelfIconObserver* observer) {
157 shelf_view_->AddIconObserver(observer); 156 shelf_view_->AddIconObserver(observer);
158 } 157 }
159 158
160 void Shelf::RemoveIconObserver(ShelfIconObserver* observer) { 159 void Shelf::RemoveIconObserver(ShelfIconObserver* observer) {
161 shelf_view_->RemoveIconObserver(observer); 160 shelf_view_->RemoveIconObserver(observer);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 211
213 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { 212 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const {
214 return shelf_view_->GetVisibleItemsBoundsInScreen(); 213 return shelf_view_->GetVisibleItemsBoundsInScreen();
215 } 214 }
216 215
217 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { 216 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() {
218 return shelf_view_; 217 return shelf_view_;
219 } 218 }
220 219
221 } // namespace ash 220 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/scoped_observer_with_duplicated_sources_unittest.cc ('k') | ash/shelf/shelf_bezel_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698