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

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

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

Powered by Google App Engine
This is Rietveld 408576698