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

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

Issue 22429004: Refactor LauncherDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bugs Created 7 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/launcher/launcher.h" 5 #include "ash/launcher/launcher.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"
11 #include "ash/launcher/launcher_delegate.h" 11 #include "ash/launcher/launcher_delegate.h"
12 #include "ash/launcher/launcher_item_delegate.h"
12 #include "ash/launcher/launcher_model.h" 13 #include "ash/launcher/launcher_model.h"
13 #include "ash/launcher/launcher_navigator.h" 14 #include "ash/launcher/launcher_navigator.h"
14 #include "ash/launcher/launcher_view.h" 15 #include "ash/launcher/launcher_view.h"
15 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
16 #include "ash/screen_ash.h" 17 #include "ash/screen_ash.h"
17 #include "ash/shelf/shelf_layout_manager.h" 18 #include "ash/shelf/shelf_layout_manager.h"
18 #include "ash/shelf/shelf_widget.h" 19 #include "ash/shelf/shelf_widget.h"
19 #include "ash/shell.h" 20 #include "ash/shell.h"
20 #include "ash/shell_delegate.h" 21 #include "ash/shell_delegate.h"
21 #include "ash/shell_window_ids.h" 22 #include "ash/shell_window_ids.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void Launcher::ActivateLauncherItem(int index) { 102 void Launcher::ActivateLauncherItem(int index) {
102 // We pass in a keyboard event which will then trigger a switch to the 103 // We pass in a keyboard event which will then trigger a switch to the
103 // next item if the current one is already active. 104 // next item if the current one is already active.
104 ui::KeyEvent event(ui::ET_KEY_RELEASED, 105 ui::KeyEvent event(ui::ET_KEY_RELEASED,
105 ui::VKEY_UNKNOWN, // The actual key gets ignored. 106 ui::VKEY_UNKNOWN, // The actual key gets ignored.
106 ui::EF_NONE, 107 ui::EF_NONE,
107 false); 108 false);
108 109
109 const ash::LauncherItems& items = 110 const ash::LauncherItems& items =
110 launcher_view_->model()->items(); 111 launcher_view_->model()->items();
111 delegate_->ItemSelected(items[index], event); 112 LauncherItemDelegate* item_delegate =
113 delegate_->GetLauncherItemDelegate(items[index]);
114 if (item_delegate)
115 item_delegate->ItemSelected(items[index], event);
112 } 116 }
113 117
114 void Launcher::CycleWindowLinear(CycleDirection direction) { 118 void Launcher::CycleWindowLinear(CycleDirection direction) {
115 int item_index = GetNextActivatedItemIndex( 119 int item_index = GetNextActivatedItemIndex(
116 *(launcher_view_->model()), direction); 120 *(launcher_view_->model()), direction);
117 if (item_index >= 0) 121 if (item_index >= 0)
118 ActivateLauncherItem(item_index); 122 ActivateLauncherItem(item_index);
119 } 123 }
120 124
121 void Launcher::AddIconObserver(LauncherIconObserver* observer) { 125 void Launcher::AddIconObserver(LauncherIconObserver* observer) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 192
189 gfx::Rect Launcher::GetLauncherViewBounds() const { 193 gfx::Rect Launcher::GetLauncherViewBounds() const {
190 return launcher_view_->bounds(); 194 return launcher_view_->bounds();
191 } 195 }
192 196
193 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() { 197 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() {
194 return launcher_view_; 198 return launcher_view_;
195 } 199 }
196 200
197 } // namespace ash 201 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698