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

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

Issue 2608013002: mash: Replace ShelfItemDelegate::CanPin with ShelfItem::pinned_by_policy. (Closed)
Patch Set: Fix test. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_shortcut_launcher_item_controller.h " 5 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h "
6 6
7 #include <stddef.h> 7 #include <stddef.h>
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 base::string16 AppShortcutLauncherItemController::GetTitle() { 219 base::string16 AppShortcutLauncherItemController::GetTitle() {
220 return LauncherControllerHelper::GetAppTitle(launcher_controller()->profile(), 220 return LauncherControllerHelper::GetAppTitle(launcher_controller()->profile(),
221 app_id()); 221 app_id());
222 } 222 }
223 223
224 ash::ShelfMenuModel* AppShortcutLauncherItemController::CreateApplicationMenu( 224 ash::ShelfMenuModel* AppShortcutLauncherItemController::CreateApplicationMenu(
225 int event_flags) { 225 int event_flags) {
226 return new LauncherApplicationMenuItemModel(GetApplicationList(event_flags)); 226 return new LauncherApplicationMenuItemModel(GetApplicationList(event_flags));
227 } 227 }
228 228
229 bool AppShortcutLauncherItemController::CanPin() const {
230 return GetPinnableForAppID(app_id(), launcher_controller()->profile()) ==
231 AppListControllerDelegate::PIN_EDITABLE;
232 }
233
234 content::WebContents* AppShortcutLauncherItemController::GetLRUApplication() { 229 content::WebContents* AppShortcutLauncherItemController::GetLRUApplication() {
235 URLPattern refocus_pattern(URLPattern::SCHEME_ALL); 230 URLPattern refocus_pattern(URLPattern::SCHEME_ALL);
236 refocus_pattern.SetMatchAllURLs(true); 231 refocus_pattern.SetMatchAllURLs(true);
237 232
238 if (!refocus_url_.is_empty()) { 233 if (!refocus_url_.is_empty()) {
239 refocus_pattern.SetMatchAllURLs(false); 234 refocus_pattern.SetMatchAllURLs(false);
240 refocus_pattern.Parse(refocus_url_.spec()); 235 refocus_pattern.Parse(refocus_url_.spec());
241 } 236 }
242 237
243 const Extension* extension = 238 const Extension* extension =
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 365
371 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { 366 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() {
372 if (last_launch_attempt_.is_null() || 367 if (last_launch_attempt_.is_null() ||
373 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( 368 last_launch_attempt_ + base::TimeDelta::FromMilliseconds(
374 kClickSuppressionInMS) < base::Time::Now()) { 369 kClickSuppressionInMS) < base::Time::Now()) {
375 last_launch_attempt_ = base::Time::Now(); 370 last_launch_attempt_ = base::Time::Now();
376 return true; 371 return true;
377 } 372 }
378 return false; 373 return false;
379 } 374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698