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

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

Issue 2052013002: Adding ChromeLauncherController interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome_launcher_smaller_api
Patch Set: Rebase Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/arc_launcher_context_menu.h" 5 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h"
6 6
7 #include "ash/common/shelf/shelf_item_types.h" 7 #include "ash/common/shelf/shelf_item_types.h"
8 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 8 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
9 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
10 10
11 ArcLauncherContextMenu::ArcLauncherContextMenu( 11 ArcLauncherContextMenu::ArcLauncherContextMenu(
12 ChromeLauncherController* controller, 12 ChromeLauncherControllerImpl* controller,
13 const ash::ShelfItem* item, 13 const ash::ShelfItem* item,
14 ash::WmShelf* wm_shelf) 14 ash::WmShelf* wm_shelf)
15 : LauncherContextMenu(controller, item, wm_shelf) { 15 : LauncherContextMenu(controller, item, wm_shelf) {
16 Init(); 16 Init();
17 } 17 }
18 18
19 ArcLauncherContextMenu::~ArcLauncherContextMenu() {} 19 ArcLauncherContextMenu::~ArcLauncherContextMenu() {}
20 20
21 void ArcLauncherContextMenu::Init() { 21 void ArcLauncherContextMenu::Init() {
22 const bool app_is_open = controller()->IsOpen(item().id); 22 const bool app_is_open = controller()->IsOpen(item().id);
23 if (!app_is_open) { 23 if (!app_is_open) {
24 AddItemWithStringId(MENU_OPEN_NEW, IDS_APP_CONTEXT_MENU_ACTIVATE_ARC); 24 AddItemWithStringId(MENU_OPEN_NEW, IDS_APP_CONTEXT_MENU_ACTIVATE_ARC);
25 AddSeparator(ui::NORMAL_SEPARATOR); 25 AddSeparator(ui::NORMAL_SEPARATOR);
26 } 26 }
27 AddPinMenu(); 27 AddPinMenu();
28 if (app_is_open) 28 if (app_is_open)
29 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE); 29 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE);
30 AddSeparator(ui::NORMAL_SEPARATOR); 30 AddSeparator(ui::NORMAL_SEPARATOR);
31 AddShelfOptionsMenu(); 31 AddShelfOptionsMenu();
32 } 32 }
33 33
34 bool ArcLauncherContextMenu::IsCommandIdEnabled(int command_id) const { 34 bool ArcLauncherContextMenu::IsCommandIdEnabled(int command_id) const {
35 if (command_id == MENU_OPEN_NEW) 35 if (command_id == MENU_OPEN_NEW)
36 return true; 36 return true;
37 return LauncherContextMenu::IsCommandIdEnabled(command_id); 37 return LauncherContextMenu::IsCommandIdEnabled(command_id);
38 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698