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

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

Issue 23606016: Refactor LauncherItemController and LauncherItemDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for unittest.. Created 7 years, 2 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/ash.gyp ('k') | ash/launcher/launcher_delegate.h » ('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 (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"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 void Launcher::ActivateLauncherItem(int index) { 102 void Launcher::ActivateLauncherItem(int index) {
103 // 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
104 // next item if the current one is already active. 104 // next item if the current one is already active.
105 ui::KeyEvent event(ui::ET_KEY_RELEASED, 105 ui::KeyEvent event(ui::ET_KEY_RELEASED,
106 ui::VKEY_UNKNOWN, // The actual key gets ignored. 106 ui::VKEY_UNKNOWN, // The actual key gets ignored.
107 ui::EF_NONE, 107 ui::EF_NONE,
108 false); 108 false);
109 109
110 const ash::LauncherItem& item = launcher_view_->model()->items()[index]; 110 const ash::LauncherItem& item = launcher_view_->model()->items()[index];
111 Shell::GetInstance()->launcher_item_delegate_manager()-> 111 ash::LauncherItemDelegate* item_delegate =
112 GetLauncherItemDelegate(item.type)->ItemSelected(item, event); 112 Shell::GetInstance()->launcher_item_delegate_manager()->
113 GetLauncherItemDelegate(item.id);
114 if (item_delegate)
115 item_delegate->ItemSelected(event);
113 } 116 }
114 117
115 void Launcher::CycleWindowLinear(CycleDirection direction) { 118 void Launcher::CycleWindowLinear(CycleDirection direction) {
116 int item_index = GetNextActivatedItemIndex( 119 int item_index = GetNextActivatedItemIndex(
117 *(launcher_view_->model()), direction); 120 *(launcher_view_->model()), direction);
118 if (item_index >= 0) 121 if (item_index >= 0)
119 ActivateLauncherItem(item_index); 122 ActivateLauncherItem(item_index);
120 } 123 }
121 124
122 void Launcher::AddIconObserver(LauncherIconObserver* observer) { 125 void Launcher::AddIconObserver(LauncherIconObserver* observer) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 185
183 gfx::Rect Launcher::GetLauncherViewBounds() const { 186 gfx::Rect Launcher::GetLauncherViewBounds() const {
184 return launcher_view_->bounds(); 187 return launcher_view_->bounds();
185 } 188 }
186 189
187 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() { 190 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() {
188 return launcher_view_; 191 return launcher_view_;
189 } 192 }
190 193
191 } // namespace ash 194 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/launcher/launcher_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698