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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_context_menu.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/app_list/arc/arc_app_context_menu.h" 5 #include "chrome/browser/ui/app_list/arc/arc_app_context_menu.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" 8 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
(...skipping 18 matching lines...) Expand all
29 AppContextMenu::BuildMenu(menu_model); 29 AppContextMenu::BuildMenu(menu_model);
30 if (CanBeUninstalled()) { 30 if (CanBeUninstalled()) {
31 menu_model->AddSeparator(ui::NORMAL_SEPARATOR); 31 menu_model->AddSeparator(ui::NORMAL_SEPARATOR);
32 menu_model->AddItemWithStringId(UNINSTALL, IDS_APP_LIST_UNINSTALL_ITEM); 32 menu_model->AddItemWithStringId(UNINSTALL, IDS_APP_LIST_UNINSTALL_ITEM);
33 } 33 }
34 } 34 }
35 35
36 bool ArcAppContextMenu::IsCommandIdEnabled(int command_id) const { 36 bool ArcAppContextMenu::IsCommandIdEnabled(int command_id) const {
37 if (command_id == LAUNCH_NEW) { 37 if (command_id == LAUNCH_NEW) {
38 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile()); 38 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile());
39 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id()); 39 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
40 arc_prefs->GetApp(app_id());
40 return app_info && app_info->ready; 41 return app_info && app_info->ready;
41 } 42 }
42 return AppContextMenu::IsCommandIdEnabled(command_id); 43 return AppContextMenu::IsCommandIdEnabled(command_id);
43 } 44 }
44 45
45 void ArcAppContextMenu::ExecuteCommand(int command_id, int event_flags) { 46 void ArcAppContextMenu::ExecuteCommand(int command_id, int event_flags) {
46 switch (command_id) { 47 switch (command_id) {
47 case LAUNCH_NEW: 48 case LAUNCH_NEW:
48 delegate()->ExecuteLaunchCommand(event_flags); 49 delegate()->ExecuteLaunchCommand(event_flags);
49 break; 50 break;
50 case UNINSTALL: 51 case UNINSTALL:
51 UninstallPackage(); 52 UninstallPackage();
52 break; 53 break;
53 default: 54 default:
54 AppContextMenu::ExecuteCommand(command_id, event_flags); 55 AppContextMenu::ExecuteCommand(command_id, event_flags);
55 } 56 }
56 } 57 }
57 58
58 void ArcAppContextMenu::UninstallPackage() { 59 void ArcAppContextMenu::UninstallPackage() {
59 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile()); 60 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile());
60 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id()); 61 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
62 arc_prefs->GetApp(app_id());
61 if (!app_info) { 63 if (!app_info) {
62 LOG(ERROR) << "Package being uninstalling does not exist"; 64 LOG(ERROR) << "Package being uninstalling does not exist";
63 return; 65 return;
64 } 66 }
65 arc::UninstallPackage(app_info->package_name); 67 arc::UninstallPackage(app_info->package_name);
66 } 68 }
67 69
68 bool ArcAppContextMenu::CanBeUninstalled() const { 70 bool ArcAppContextMenu::CanBeUninstalled() const {
69 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile()); 71 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile());
70 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id()); 72 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
73 arc_prefs->GetApp(app_id());
71 return app_info && app_info->ready && !app_info->sticky; 74 return app_info && app_info->ready && !app_info->sticky;
72 } 75 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.cc ('k') | chrome/browser/ui/app_list/arc/arc_app_icon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698