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

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

Issue 2860503002: mash: Replace int ShelfIDs with AppLaunchID strings. (Closed)
Patch Set: Fix struct traits typo. Created 3 years, 7 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/shelf/shelf_view_unittest.cc ('k') | ash/shelf/shelf_window_watcher.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_widget.h" 5 #include "ash/shelf/shelf_widget.h"
6 6
7 #include "ash/animation/animation_change_type.h" 7 #include "ash/animation/animation_change_type.h"
8 #include "ash/focus_cycler.h" 8 #include "ash/focus_cycler.h"
9 #include "ash/public/cpp/window_properties.h"
9 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
10 #include "ash/session/session_controller.h" 11 #include "ash/session/session_controller.h"
11 #include "ash/shelf/app_list_button.h" 12 #include "ash/shelf/app_list_button.h"
12 #include "ash/shelf/shelf_background_animator_observer.h" 13 #include "ash/shelf/shelf_background_animator_observer.h"
13 #include "ash/shelf/shelf_constants.h" 14 #include "ash/shelf/shelf_constants.h"
14 #include "ash/shelf/shelf_layout_manager.h" 15 #include "ash/shelf/shelf_layout_manager.h"
15 #include "ash/shelf/shelf_view.h" 16 #include "ash/shelf/shelf_view.h"
16 #include "ash/shelf/wm_shelf.h" 17 #include "ash/shelf/wm_shelf.h"
17 #include "ash/shell.h" 18 #include "ash/shell.h"
18 #include "ash/system/status_area_layout_manager.h" 19 #include "ash/system/status_area_layout_manager.h"
19 #include "ash/system/status_area_widget.h" 20 #include "ash/system/status_area_widget.h"
20 #include "ash/wm/window_properties.h"
21 #include "ash/wm_window.h" 21 #include "ash/wm_window.h"
22 #include "base/memory/ptr_util.h" 22 #include "base/memory/ptr_util.h"
23 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
24 #include "ui/compositor/scoped_layer_animation_settings.h" 24 #include "ui/compositor/scoped_layer_animation_settings.h"
25 #include "ui/gfx/skbitmap_operations.h" 25 #include "ui/gfx/skbitmap_operations.h"
26 #include "ui/views/accessible_pane_view.h" 26 #include "ui/views/accessible_pane_view.h"
27 #include "ui/views/layout/fill_layout.h" 27 #include "ui/views/layout/fill_layout.h"
28 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
29 #include "ui/views/widget/widget_delegate.h" 29 #include "ui/views/widget/widget_delegate.h"
30 30
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 background_animator_.RemoveObserver(status_area_widget_); 292 background_animator_.RemoveObserver(status_area_widget_);
293 Shell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); 293 Shell::Get()->focus_cycler()->RemoveWidget(status_area_widget_);
294 status_area_widget_->Shutdown(); 294 status_area_widget_->Shutdown();
295 status_area_widget_ = nullptr; 295 status_area_widget_ = nullptr;
296 } 296 }
297 297
298 CloseNow(); 298 CloseNow();
299 } 299 }
300 300
301 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { 301 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) {
302 if (!shelf_view_) 302 ShelfID* id = panel->aura_window()->GetProperty(kShelfIDKey);
303 if (!shelf_view_ || !id)
303 return; 304 return;
304 305
305 WmWindow* shelf_window = WmWindow::Get(this->GetNativeWindow()); 306 WmWindow* shelf_window = WmWindow::Get(this->GetNativeWindow());
306 shelf_view_->UpdatePanelIconPosition( 307 shelf_view_->UpdatePanelIconPosition(
307 panel->aura_window()->GetProperty(kShelfIDKey), 308 *id, shelf_window->ConvertRectFromScreen(panel->GetBoundsInScreen())
308 shelf_window->ConvertRectFromScreen(panel->GetBoundsInScreen()) 309 .CenterPoint());
309 .CenterPoint());
310 } 310 }
311 311
312 gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { 312 gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) {
313 ShelfID* id = window->aura_window()->GetProperty(kShelfIDKey);
313 // Window animations can be triggered during session restore before the shelf 314 // Window animations can be triggered during session restore before the shelf
314 // view is created. In that case, return default empty bounds. 315 // view is created. In that case, return default empty bounds.
315 if (!shelf_view_) 316 if (!shelf_view_ || !id)
316 return gfx::Rect(); 317 return gfx::Rect();
317 318
318 ShelfID id = window->aura_window()->GetProperty(kShelfIDKey); 319 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(*id));
319 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id));
320 gfx::Point screen_origin; 320 gfx::Point screen_origin;
321 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); 321 views::View::ConvertPointToScreen(shelf_view_, &screen_origin);
322 return gfx::Rect(screen_origin.x() + bounds.x(), 322 return gfx::Rect(screen_origin.x() + bounds.x(),
323 screen_origin.y() + bounds.y(), bounds.width(), 323 screen_origin.y() + bounds.y(), bounds.width(),
324 bounds.height()); 324 bounds.height());
325 } 325 }
326 326
327 AppListButton* ShelfWidget::GetAppListButton() const { 327 AppListButton* ShelfWidget::GetAppListButton() const {
328 return shelf_view_ ? shelf_view_->GetAppListButton() : nullptr; 328 return shelf_view_ ? shelf_view_->GetAppListButton() : nullptr;
329 } 329 }
(...skipping 16 matching lines...) Expand all
346 if (shelf_view_) 346 if (shelf_view_)
347 shelf_view_->UpdateShelfItemBackground(color); 347 shelf_view_->UpdateShelfItemBackground(color);
348 } 348 }
349 349
350 void ShelfWidget::WillDeleteShelfLayoutManager() { 350 void ShelfWidget::WillDeleteShelfLayoutManager() {
351 shelf_layout_manager_->RemoveObserver(this); 351 shelf_layout_manager_->RemoveObserver(this);
352 shelf_layout_manager_ = nullptr; 352 shelf_layout_manager_ = nullptr;
353 } 353 }
354 354
355 } // namespace ash 355 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view_unittest.cc ('k') | ash/shelf/shelf_window_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698