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

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 for OpenBrowserUsingShelfOnOhterDisplay fail Created 7 years, 3 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"
13 #include "ash/launcher/launcher_item_delegate_manager.h"
12 #include "ash/launcher/launcher_model.h" 14 #include "ash/launcher/launcher_model.h"
13 #include "ash/launcher/launcher_navigator.h" 15 #include "ash/launcher/launcher_navigator.h"
14 #include "ash/launcher/launcher_view.h" 16 #include "ash/launcher/launcher_view.h"
15 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
16 #include "ash/screen_ash.h" 18 #include "ash/screen_ash.h"
17 #include "ash/shelf/shelf_layout_manager.h" 19 #include "ash/shelf/shelf_layout_manager.h"
18 #include "ash/shelf/shelf_widget.h" 20 #include "ash/shelf/shelf_widget.h"
19 #include "ash/shell.h" 21 #include "ash/shell.h"
20 #include "ash/shell_delegate.h" 22 #include "ash/shell_delegate.h"
21 #include "ash/shell_window_ids.h" 23 #include "ash/shell_window_ids.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 101 }
100 102
101 void Launcher::ActivateLauncherItem(int index) { 103 void Launcher::ActivateLauncherItem(int index) {
102 // We pass in a keyboard event which will then trigger a switch to the 104 // We pass in a keyboard event which will then trigger a switch to the
103 // next item if the current one is already active. 105 // next item if the current one is already active.
104 ui::KeyEvent event(ui::ET_KEY_RELEASED, 106 ui::KeyEvent event(ui::ET_KEY_RELEASED,
105 ui::VKEY_UNKNOWN, // The actual key gets ignored. 107 ui::VKEY_UNKNOWN, // The actual key gets ignored.
106 ui::EF_NONE, 108 ui::EF_NONE,
107 false); 109 false);
108 110
109 const ash::LauncherItems& items = 111 const ash::LauncherItem& item = launcher_view_->model()->items()[index];
110 launcher_view_->model()->items(); 112 Shell::GetInstance()->launcher_item_delegate_manager()->
111 delegate_->ItemSelected(items[index], event); 113 GetLauncherItemDelegate(item.type)->ItemSelected(item, event);
112 } 114 }
113 115
114 void Launcher::CycleWindowLinear(CycleDirection direction) { 116 void Launcher::CycleWindowLinear(CycleDirection direction) {
115 int item_index = GetNextActivatedItemIndex( 117 int item_index = GetNextActivatedItemIndex(
116 *(launcher_view_->model()), direction); 118 *(launcher_view_->model()), direction);
117 if (item_index >= 0) 119 if (item_index >= 0)
118 ActivateLauncherItem(item_index); 120 ActivateLauncherItem(item_index);
119 } 121 }
120 122
121 void Launcher::AddIconObserver(LauncherIconObserver* observer) { 123 void Launcher::AddIconObserver(LauncherIconObserver* observer) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 187
186 gfx::Rect Launcher::GetLauncherViewBounds() const { 188 gfx::Rect Launcher::GetLauncherViewBounds() const {
187 return launcher_view_->bounds(); 189 return launcher_view_->bounds();
188 } 190 }
189 191
190 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() { 192 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() {
191 return launcher_view_; 193 return launcher_view_;
192 } 194 }
193 195
194 } // namespace ash 196 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698