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

Side by Side Diff: ash/app_list/app_list_presenter_delegate.cc

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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 (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/app_list/app_list_presenter_delegate.h" 5 #include "ash/app_list/app_list_presenter_delegate.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/public/cpp/shelf_types.h" 8 #include "ash/public/cpp/shelf_types.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/screen_util.h" 11 #include "ash/screen_util.h"
12 #include "ash/shelf/app_list_button.h" 12 #include "ash/shelf/app_list_button.h"
13 #include "ash/shelf/shelf_layout_manager.h" 13 #include "ash/shelf/shelf_layout_manager.h"
14 #include "ash/shelf/shelf_widget.h" 14 #include "ash/shelf/shelf_widget.h"
15 #include "ash/shelf/wm_shelf.h" 15 #include "ash/shelf/wm_shelf.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/shell_port.h"
17 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
18 #include "ash/wm/wm_screen_util.h" 19 #include "ash/wm/wm_screen_util.h"
19 #include "ash/wm_shell.h"
20 #include "ash/wm_window.h" 20 #include "ash/wm_window.h"
21 #include "base/command_line.h" 21 #include "base/command_line.h"
22 #include "ui/app_list/app_list_constants.h" 22 #include "ui/app_list/app_list_constants.h"
23 #include "ui/app_list/app_list_switches.h" 23 #include "ui/app_list/app_list_switches.h"
24 #include "ui/app_list/presenter/app_list_presenter_impl.h" 24 #include "ui/app_list/presenter/app_list_presenter_impl.h"
25 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" 25 #include "ui/app_list/presenter/app_list_view_delegate_factory.h"
26 #include "ui/app_list/views/app_list_view.h" 26 #include "ui/app_list/views/app_list_view.h"
27 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
28 #include "ui/events/event.h" 28 #include "ui/events/event.h"
29 #include "ui/keyboard/keyboard_controller.h" 29 #include "ui/keyboard/keyboard_controller.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void AppListPresenterDelegate::Init(app_list::AppListView* view, 88 void AppListPresenterDelegate::Init(app_list::AppListView* view,
89 int64_t display_id, 89 int64_t display_id,
90 int current_apps_page) { 90 int current_apps_page) {
91 // App list needs to know the new shelf layout in order to calculate its 91 // App list needs to know the new shelf layout in order to calculate its
92 // UI layout when AppListView visibility changes. 92 // UI layout when AppListView visibility changes.
93 ash::Shell::GetPrimaryRootWindowController() 93 ash::Shell::GetPrimaryRootWindowController()
94 ->GetShelfLayoutManager() 94 ->GetShelfLayoutManager()
95 ->UpdateAutoHideState(); 95 ->UpdateAutoHideState();
96 view_ = view; 96 view_ = view;
97 WmWindow* wm_root_window = 97 WmWindow* wm_root_window =
98 WmShell::Get()->GetRootWindowForDisplayId(display_id); 98 ShellPort::Get()->GetRootWindowForDisplayId(display_id);
99 aura::Window* root_window = wm_root_window->aura_window(); 99 aura::Window* root_window = wm_root_window->aura_window();
100 aura::Window* container = GetRootWindowController(root_window) 100 aura::Window* container = GetRootWindowController(root_window)
101 ->GetContainer(kShellWindowId_AppListContainer); 101 ->GetContainer(kShellWindowId_AppListContainer);
102 view->InitAsBubble(container, current_apps_page); 102 view->InitAsBubble(container, current_apps_page);
103 // The app list is centered over the display. 103 // The app list is centered over the display.
104 view->SetAnchorPoint(GetCenterOfDisplayForWindow( 104 view->SetAnchorPoint(GetCenterOfDisplayForWindow(
105 wm_root_window, GetMinimumBoundsHeightForAppList(view))); 105 wm_root_window, GetMinimumBoundsHeightForAppList(view)));
106 106
107 keyboard::KeyboardController* keyboard_controller = 107 keyboard::KeyboardController* keyboard_controller =
108 keyboard::KeyboardController::GetInstance(); 108 keyboard::KeyboardController::GetInstance();
109 if (keyboard_controller) 109 if (keyboard_controller)
110 keyboard_controller->AddObserver(this); 110 keyboard_controller->AddObserver(this);
111 Shell::Get()->AddPreTargetHandler(this); 111 Shell::Get()->AddPreTargetHandler(this);
112 WmShelf* shelf = WmShelf::ForWindow(wm_root_window); 112 WmShelf* shelf = WmShelf::ForWindow(wm_root_window);
113 shelf->AddObserver(this); 113 shelf->AddObserver(this);
114 114
115 // By setting us as DnD recipient, the app list knows that we can 115 // By setting us as DnD recipient, the app list knows that we can
116 // handle items. 116 // handle items.
117 view->SetDragAndDropHostOfCurrentAppList( 117 view->SetDragAndDropHostOfCurrentAppList(
118 shelf->shelf_widget()->GetDragAndDropHostForAppList()); 118 shelf->shelf_widget()->GetDragAndDropHostForAppList());
119 } 119 }
120 120
121 void AppListPresenterDelegate::OnShown(int64_t display_id) { 121 void AppListPresenterDelegate::OnShown(int64_t display_id) {
122 is_visible_ = true; 122 is_visible_ = true;
123 // Update applist button status when app list visibility is changed. 123 // Update applist button status when app list visibility is changed.
124 WmWindow* root_window = WmShell::Get()->GetRootWindowForDisplayId(display_id); 124 WmWindow* root_window =
125 ShellPort::Get()->GetRootWindowForDisplayId(display_id);
125 AppListButton* app_list_button = 126 AppListButton* app_list_button =
126 WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); 127 WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton();
127 if (app_list_button) 128 if (app_list_button)
128 app_list_button->OnAppListShown(); 129 app_list_button->OnAppListShown();
129 } 130 }
130 131
131 void AppListPresenterDelegate::OnDismissed() { 132 void AppListPresenterDelegate::OnDismissed() {
132 DCHECK(is_visible_); 133 DCHECK(is_visible_);
133 DCHECK(view_); 134 DCHECK(view_);
134 135
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 239 }
239 240
240 //////////////////////////////////////////////////////////////////////////////// 241 ////////////////////////////////////////////////////////////////////////////////
241 // AppListPresenterDelegate, WmShelfObserver implementation: 242 // AppListPresenterDelegate, WmShelfObserver implementation:
242 243
243 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 244 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
244 UpdateBounds(); 245 UpdateBounds();
245 } 246 }
246 247
247 } // namespace ash 248 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698