| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 11 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 11 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/base/base_window.h" | 14 #include "ui/base/base_window.h" |
| 14 #include "ui/wm/core/window_animations.h" | 15 #include "ui/wm/core/window_animations.h" |
| 15 | 16 |
| 16 AppWindowLauncherItemController::AppWindowLauncherItemController( | 17 AppWindowLauncherItemController::AppWindowLauncherItemController( |
| 17 Type type, | 18 Type type, |
| 18 const std::string& app_shelf_id, | 19 const std::string& app_shelf_id, |
| 19 const std::string& app_id, | 20 const std::string& app_id, |
| 20 ChromeLauncherController* controller) | 21 ChromeLauncherController* controller) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // item if the window we are trying to activate is already active. | 131 // item if the window we are trying to activate is already active. |
| 131 if (windows_.size() >= 1 && window_to_show->IsActive() && | 132 if (windows_.size() >= 1 && window_to_show->IsActive() && |
| 132 event.type() == ui::ET_KEY_RELEASED) { | 133 event.type() == ui::ET_KEY_RELEASED) { |
| 133 return ActivateOrAdvanceToNextAppWindow(window_to_show); | 134 return ActivateOrAdvanceToNextAppWindow(window_to_show); |
| 134 } else { | 135 } else { |
| 135 return ShowAndActivateOrMinimize(window_to_show); | 136 return ShowAndActivateOrMinimize(window_to_show); |
| 136 } | 137 } |
| 137 } | 138 } |
| 138 | 139 |
| 139 base::string16 AppWindowLauncherItemController::GetTitle() { | 140 base::string16 AppWindowLauncherItemController::GetTitle() { |
| 140 return GetAppTitle(); | 141 return LauncherControllerHelper::GetAppTitle(launcher_controller()->profile(), |
| 142 app_id()); |
| 141 } | 143 } |
| 142 | 144 |
| 143 bool AppWindowLauncherItemController::IsDraggable() { | 145 bool AppWindowLauncherItemController::IsDraggable() { |
| 144 DCHECK_EQ(TYPE_APP, type()); | 146 DCHECK_EQ(TYPE_APP, type()); |
| 145 return CanPin(); | 147 return CanPin(); |
| 146 } | 148 } |
| 147 | 149 |
| 148 bool AppWindowLauncherItemController::CanPin() const { | 150 bool AppWindowLauncherItemController::CanPin() const { |
| 149 return launcher_controller()->GetPinnable(app_id()) == | 151 return launcher_controller()->GetPinnable(app_id()) == |
| 150 AppListControllerDelegate::PIN_EDITABLE; | 152 AppListControllerDelegate::PIN_EDITABLE; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (window_to_show->IsActive()) { | 196 if (window_to_show->IsActive()) { |
| 195 // Coming here, only a single window is active. For keyboard activations | 197 // Coming here, only a single window is active. For keyboard activations |
| 196 // the window gets animated. | 198 // the window gets animated. |
| 197 AnimateWindow(window_to_show->GetNativeWindow(), | 199 AnimateWindow(window_to_show->GetNativeWindow(), |
| 198 wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 200 wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 199 } else { | 201 } else { |
| 200 return ShowAndActivateOrMinimize(window_to_show); | 202 return ShowAndActivateOrMinimize(window_to_show); |
| 201 } | 203 } |
| 202 return kNoAction; | 204 return kNoAction; |
| 203 } | 205 } |
| OLD | NEW |