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

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

Issue 2684723003: Remove LauncherItemController::Launch, cleanup. (Closed)
Patch Set: Use AppLauncherId Created 3 years, 10 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return *iter; 62 return *iter;
63 return nullptr; 63 return nullptr;
64 } 64 }
65 65
66 void AppWindowLauncherItemController::SetActiveWindow(aura::Window* window) { 66 void AppWindowLauncherItemController::SetActiveWindow(aura::Window* window) {
67 ui::BaseWindow* app_window = GetAppWindow(window); 67 ui::BaseWindow* app_window = GetAppWindow(window);
68 if (app_window) 68 if (app_window)
69 last_active_window_ = app_window; 69 last_active_window_ = app_window;
70 } 70 }
71 71
72 void AppWindowLauncherItemController::Launch(ash::LaunchSource source,
73 int event_flags) {
74 launcher_controller()->LaunchApp(app_id(), source, ui::EF_NONE);
75 }
76
77 ash::ShelfItemDelegate::PerformedAction 72 ash::ShelfItemDelegate::PerformedAction
78 AppWindowLauncherItemController::Activate(ash::LaunchSource source) { 73 AppWindowLauncherItemController::Activate(ash::LaunchSource source) {
79 DCHECK(!windows_.empty()); 74 DCHECK(!windows_.empty());
80 ui::BaseWindow* window_to_activate = 75 ui::BaseWindow* window_to_activate =
81 last_active_window_ ? last_active_window_ : windows_.back(); 76 last_active_window_ ? last_active_window_ : windows_.back();
82 window_to_activate->Activate(); 77 window_to_activate->Activate();
83 return kExistingWindowActivated; 78 return kExistingWindowActivated;
84 } 79 }
85 80
86 AppWindowLauncherItemController* 81 AppWindowLauncherItemController*
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (window_to_show->IsActive()) { 159 if (window_to_show->IsActive()) {
165 // Coming here, only a single window is active. For keyboard activations 160 // Coming here, only a single window is active. For keyboard activations
166 // the window gets animated. 161 // the window gets animated.
167 AnimateWindow(window_to_show->GetNativeWindow(), 162 AnimateWindow(window_to_show->GetNativeWindow(),
168 wm::WINDOW_ANIMATION_TYPE_BOUNCE); 163 wm::WINDOW_ANIMATION_TYPE_BOUNCE);
169 } else { 164 } else {
170 return ShowAndActivateOrMinimize(window_to_show); 165 return ShowAndActivateOrMinimize(window_to_show);
171 } 166 }
172 return kNoAction; 167 return kNoAction;
173 } 168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698