| 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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | |
| 13 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 12 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 14 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
| 15 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 16 #include "ui/base/base_window.h" | 15 #include "ui/base/base_window.h" |
| 17 #include "ui/wm/core/window_animations.h" | 16 #include "ui/wm/core/window_animations.h" |
| 18 | 17 |
| 19 AppWindowLauncherItemController::AppWindowLauncherItemController( | 18 AppWindowLauncherItemController::AppWindowLauncherItemController( |
| 20 const std::string& app_id, | 19 const std::string& app_id, |
| 21 const std::string& launch_id, | 20 const std::string& launch_id, |
| 22 ChromeLauncherController* controller) | 21 ChromeLauncherController* controller) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } else { | 130 } else { |
| 132 return ShowAndActivateOrMinimize(window_to_show); | 131 return ShowAndActivateOrMinimize(window_to_show); |
| 133 } | 132 } |
| 134 } | 133 } |
| 135 | 134 |
| 136 base::string16 AppWindowLauncherItemController::GetTitle() { | 135 base::string16 AppWindowLauncherItemController::GetTitle() { |
| 137 return LauncherControllerHelper::GetAppTitle(launcher_controller()->profile(), | 136 return LauncherControllerHelper::GetAppTitle(launcher_controller()->profile(), |
| 138 app_id()); | 137 app_id()); |
| 139 } | 138 } |
| 140 | 139 |
| 141 bool AppWindowLauncherItemController::CanPin() const { | |
| 142 return GetPinnableForAppID(app_id(), launcher_controller()->profile()) == | |
| 143 AppListControllerDelegate::PIN_EDITABLE; | |
| 144 } | |
| 145 | |
| 146 void AppWindowLauncherItemController::OnWindowPropertyChanged( | 140 void AppWindowLauncherItemController::OnWindowPropertyChanged( |
| 147 aura::Window* window, | 141 aura::Window* window, |
| 148 const void* key, | 142 const void* key, |
| 149 intptr_t old) { | 143 intptr_t old) { |
| 150 if (key == aura::client::kDrawAttentionKey) { | 144 if (key == aura::client::kDrawAttentionKey) { |
| 151 ash::ShelfItemStatus status; | 145 ash::ShelfItemStatus status; |
| 152 if (ash::wm::IsActiveWindow(window)) { | 146 if (ash::wm::IsActiveWindow(window)) { |
| 153 status = ash::STATUS_ACTIVE; | 147 status = ash::STATUS_ACTIVE; |
| 154 } else if (window->GetProperty(aura::client::kDrawAttentionKey)) { | 148 } else if (window->GetProperty(aura::client::kDrawAttentionKey)) { |
| 155 status = ash::STATUS_ATTENTION; | 149 status = ash::STATUS_ATTENTION; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 182 if (window_to_show->IsActive()) { | 176 if (window_to_show->IsActive()) { |
| 183 // Coming here, only a single window is active. For keyboard activations | 177 // Coming here, only a single window is active. For keyboard activations |
| 184 // the window gets animated. | 178 // the window gets animated. |
| 185 AnimateWindow(window_to_show->GetNativeWindow(), | 179 AnimateWindow(window_to_show->GetNativeWindow(), |
| 186 wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 180 wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 187 } else { | 181 } else { |
| 188 return ShowAndActivateOrMinimize(window_to_show); | 182 return ShowAndActivateOrMinimize(window_to_show); |
| 189 } | 183 } |
| 190 return kNoAction; | 184 return kNoAction; |
| 191 } | 185 } |
| OLD | NEW |