OLD | NEW |
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 "ash/shelf/shelf_model.h" | 7 #include "ash/shelf/shelf_model.h" |
8 #include "ash/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "chrome/browser/extensions/webstore_install_with_prompt.h" | 10 #include "chrome/browser/extensions/webstore_install_with_prompt.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void AppWindowLauncherItemController::Launch(ash::LaunchSource source, | 132 void AppWindowLauncherItemController::Launch(ash::LaunchSource source, |
133 int event_flags) { | 133 int event_flags) { |
134 launcher_controller()->LaunchApp(app_id(), source, ui::EF_NONE); | 134 launcher_controller()->LaunchApp(app_id(), source, ui::EF_NONE); |
135 } | 135 } |
136 | 136 |
137 ash::ShelfItemDelegate::PerformedAction | 137 ash::ShelfItemDelegate::PerformedAction |
138 AppWindowLauncherItemController::Activate(ash::LaunchSource source) { | 138 AppWindowLauncherItemController::Activate(ash::LaunchSource source) { |
139 DCHECK(!app_windows_.empty()); | 139 DCHECK(!app_windows_.empty()); |
140 AppWindow* window_to_activate = | 140 AppWindow* window_to_activate = |
141 last_active_app_window_ ? last_active_app_window_ : app_windows_.back(); | 141 last_active_app_window_ ? last_active_app_window_ : app_windows_.back(); |
142 window_to_activate->GetBaseWindow()->Activate(); | 142 window_to_activate->GetBaseWindow()->Activate(true /* user_gesture */); |
143 return kExistingWindowActivated; | 143 return kExistingWindowActivated; |
144 } | 144 } |
145 | 145 |
146 void AppWindowLauncherItemController::Close() { | 146 void AppWindowLauncherItemController::Close() { |
147 // Note: Closing windows may affect the contents of app_windows_. | 147 // Note: Closing windows may affect the contents of app_windows_. |
148 AppWindowList windows_to_close = app_windows_; | 148 AppWindowList windows_to_close = app_windows_; |
149 for (AppWindowList::iterator iter = windows_to_close.begin(); | 149 for (AppWindowList::iterator iter = windows_to_close.begin(); |
150 iter != windows_to_close.end(); | 150 iter != windows_to_close.end(); |
151 ++iter) { | 151 ++iter) { |
152 (*iter)->GetBaseWindow()->Close(); | 152 (*iter)->GetBaseWindow()->Close(); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 if (window_to_show->GetBaseWindow()->IsActive()) { | 334 if (window_to_show->GetBaseWindow()->IsActive()) { |
335 // Coming here, only a single window is active. For keyboard activations | 335 // Coming here, only a single window is active. For keyboard activations |
336 // the window gets animated. | 336 // the window gets animated. |
337 AnimateWindow(window_to_show->GetNativeWindow(), | 337 AnimateWindow(window_to_show->GetNativeWindow(), |
338 wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 338 wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
339 } else { | 339 } else { |
340 return ShowAndActivateOrMinimize(window_to_show); | 340 return ShowAndActivateOrMinimize(window_to_show); |
341 } | 341 } |
342 return kNoAction; | 342 return kNoAction; |
343 } | 343 } |
OLD | NEW |