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

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

Issue 2247503002: mash: Create and show a shelf in mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix WindowManager WmShell::Shutdown; delay PointerWatcherEventRouter teardown; cleanup shutdown wor… Created 4 years, 4 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/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/ash_switches.h" 8 #include "ash/common/ash_switches.h"
9 #include "ash/common/shelf/app_list_button.h" 9 #include "ash/common/shelf/app_list_button.h"
10 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
11 #include "ash/common/shelf/wm_shelf.h"
11 #include "ash/common/shell_window_ids.h" 12 #include "ash/common/shell_window_ids.h"
12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
13 #include "ash/common/wm/wm_screen_util.h" 14 #include "ash/common/wm/wm_screen_util.h"
14 #include "ash/common/wm_lookup.h" 15 #include "ash/common/wm_lookup.h"
16 #include "ash/common/wm_root_window_controller.h"
15 #include "ash/common/wm_shell.h" 17 #include "ash/common/wm_shell.h"
16 #include "ash/common/wm_window.h" 18 #include "ash/common/wm_window.h"
17 #include "ash/display/window_tree_host_manager.h" 19 #include "ash/display/window_tree_host_manager.h"
18 #include "ash/root_window_controller.h" 20 #include "ash/root_window_controller.h"
19 #include "ash/screen_util.h" 21 #include "ash/screen_util.h"
20 #include "ash/shelf/shelf.h" 22 #include "ash/shelf/shelf.h"
21 #include "ash/shelf/shelf_layout_manager.h" 23 #include "ash/shelf/shelf_layout_manager.h"
22 #include "ash/shell.h" 24 #include "ash/shell.h"
23 #include "base/command_line.h" 25 #include "base/command_line.h"
24 #include "ui/app_list/app_list_constants.h" 26 #include "ui/app_list/app_list_constants.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 137 }
136 138
137 AppListPresenterDelegate::~AppListPresenterDelegate() { 139 AppListPresenterDelegate::~AppListPresenterDelegate() {
138 DCHECK(view_); 140 DCHECK(view_);
139 keyboard::KeyboardController* keyboard_controller = 141 keyboard::KeyboardController* keyboard_controller =
140 keyboard::KeyboardController::GetInstance(); 142 keyboard::KeyboardController::GetInstance();
141 if (keyboard_controller) 143 if (keyboard_controller)
142 keyboard_controller->RemoveObserver(this); 144 keyboard_controller->RemoveObserver(this);
143 Shell::GetInstance()->RemovePreTargetHandler(this); 145 Shell::GetInstance()->RemovePreTargetHandler(this);
144 WmWindow* window = WmLookup::Get()->GetWindowForWidget(view_->GetWidget()); 146 WmWindow* window = WmLookup::Get()->GetWindowForWidget(view_->GetWidget());
145 Shelf::ForWindow(window)->RemoveIconObserver(this); 147 window->GetRootWindowController()->GetShelf()->RemoveObserver(this);
146 WmShell::Get()->RemoveShellObserver(this); 148 WmShell::Get()->RemoveShellObserver(this);
147 } 149 }
148 150
149 app_list::AppListViewDelegate* AppListPresenterDelegate::GetViewDelegate() { 151 app_list::AppListViewDelegate* AppListPresenterDelegate::GetViewDelegate() {
150 return view_delegate_factory_->GetDelegate(); 152 return view_delegate_factory_->GetDelegate();
151 } 153 }
152 154
153 void AppListPresenterDelegate::Init(app_list::AppListView* view, 155 void AppListPresenterDelegate::Init(app_list::AppListView* view,
154 int64_t display_id, 156 int64_t display_id,
155 int current_apps_page) { 157 int current_apps_page) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 applist_button->GetWidget()), 199 applist_button->GetWidget()),
198 GetBubbleArrow(container), true /* border_accepts_events */); 200 GetBubbleArrow(container), true /* border_accepts_events */);
199 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); 201 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
200 } 202 }
201 203
202 keyboard::KeyboardController* keyboard_controller = 204 keyboard::KeyboardController* keyboard_controller =
203 keyboard::KeyboardController::GetInstance(); 205 keyboard::KeyboardController::GetInstance();
204 if (keyboard_controller) 206 if (keyboard_controller)
205 keyboard_controller->AddObserver(this); 207 keyboard_controller->AddObserver(this);
206 Shell::GetInstance()->AddPreTargetHandler(this); 208 Shell::GetInstance()->AddPreTargetHandler(this);
207 shelf->AddIconObserver(this); 209 WmWindow* window = WmShell::Get()->GetRootWindowForDisplayId(display_id);
210 window->GetRootWindowController()->GetShelf()->AddObserver(this);
208 211
209 // By setting us as DnD recipient, the app list knows that we can 212 // By setting us as DnD recipient, the app list knows that we can
210 // handle items. 213 // handle items.
211 view->SetDragAndDropHostOfCurrentAppList( 214 view->SetDragAndDropHostOfCurrentAppList(
212 shelf->GetDragAndDropHostForAppList()); 215 shelf->GetDragAndDropHostForAppList());
213 } 216 }
214 217
215 void AppListPresenterDelegate::OnShown(int64_t display_id) { 218 void AppListPresenterDelegate::OnShown(int64_t display_id) {
216 is_visible_ = true; 219 is_visible_ = true;
217 // Update applist button status when app list visibility is changed. 220 // Update applist button status when app list visibility is changed.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 presenter_->Dismiss(); 348 presenter_->Dismiss();
346 } 349 }
347 350
348 void AppListPresenterDelegate::OnMaximizeModeEnded() { 351 void AppListPresenterDelegate::OnMaximizeModeEnded() {
349 // See the comments of OnMaximizeModeStarted(). 352 // See the comments of OnMaximizeModeStarted().
350 if (IsFullscreenAppListEnabled() && is_visible_) 353 if (IsFullscreenAppListEnabled() && is_visible_)
351 presenter_->Dismiss(); 354 presenter_->Dismiss();
352 } 355 }
353 356
354 //////////////////////////////////////////////////////////////////////////////// 357 ////////////////////////////////////////////////////////////////////////////////
355 // AppListPresenterDelegate, ShelfIconObserver implementation: 358 // AppListPresenterDelegate, WmShelfObserver implementation:
356 359
357 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 360 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
358 UpdateBounds(); 361 UpdateBounds();
359 } 362 }
360 363
361 } // namespace ash 364 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698