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

Side by Side Diff: chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.cc

Issue 2628023002: Fix cannot select and activate pinned v2app through launcher context menu (Closed)
Patch Set: AsAppWindowLauncherItemController Created 3 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" 5 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int event_flags) { 111 int event_flags) {
112 ChromeLauncherAppMenuItems items; 112 ChromeLauncherAppMenuItems items;
113 // Add the application name to the menu. 113 // Add the application name to the menu.
114 base::string16 app_title = LauncherControllerHelper::GetAppTitle( 114 base::string16 app_title = LauncherControllerHelper::GetAppTitle(
115 launcher_controller()->profile(), app_id()); 115 launcher_controller()->profile(), app_id());
116 items.push_back( 116 items.push_back(
117 base::MakeUnique<ChromeLauncherAppMenuItem>(app_title, nullptr, false)); 117 base::MakeUnique<ChromeLauncherAppMenuItem>(app_title, nullptr, false));
118 return items; 118 return items;
119 } 119 }
120 120
121 AppWindowLauncherItemController*
122 AppWindowLauncherItemController::AsAppWindowLauncherItemController() {
123 return this;
124 }
125
121 ash::ShelfItemDelegate::PerformedAction 126 ash::ShelfItemDelegate::PerformedAction
122 AppWindowLauncherItemController::ItemSelected(const ui::Event& event) { 127 AppWindowLauncherItemController::ItemSelected(const ui::Event& event) {
123 if (windows_.empty()) 128 if (windows_.empty())
124 return kNoAction; 129 return kNoAction;
125 130
126 ui::BaseWindow* window_to_show = 131 ui::BaseWindow* window_to_show =
127 last_active_window_ ? last_active_window_ : windows_.front(); 132 last_active_window_ ? last_active_window_ : windows_.front();
128 // If the event was triggered by a keystroke, we try to advance to the next 133 // If the event was triggered by a keystroke, we try to advance to the next
129 // item if the window we are trying to activate is already active. 134 // item if the window we are trying to activate is already active.
130 if (windows_.size() >= 1 && window_to_show->IsActive() && 135 if (windows_.size() >= 1 && window_to_show->IsActive() &&
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (window_to_show->IsActive()) { 179 if (window_to_show->IsActive()) {
175 // Coming here, only a single window is active. For keyboard activations 180 // Coming here, only a single window is active. For keyboard activations
176 // the window gets animated. 181 // the window gets animated.
177 AnimateWindow(window_to_show->GetNativeWindow(), 182 AnimateWindow(window_to_show->GetNativeWindow(),
178 wm::WINDOW_ANIMATION_TYPE_BOUNCE); 183 wm::WINDOW_ANIMATION_TYPE_BOUNCE);
179 } else { 184 } else {
180 return ShowAndActivateOrMinimize(window_to_show); 185 return ShowAndActivateOrMinimize(window_to_show);
181 } 186 }
182 return kNoAction; 187 return kNoAction;
183 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698