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

Side by Side Diff: ui/app_list/app_list_menu.cc

Issue 2143893002: Purge the App Launcher code from Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comment Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/app_list/app_list_menu.h" 5 #include "ui/app_list/app_list_menu.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/app_list/app_list_view_delegate.h" 10 #include "ui/app_list/app_list_view_delegate.h"
(...skipping 12 matching lines...) Expand all
23 InitMenu(); 23 InitMenu();
24 } 24 }
25 25
26 AppListMenu::~AppListMenu() {} 26 AppListMenu::~AppListMenu() {}
27 27
28 void AppListMenu::InitMenu() { 28 void AppListMenu::InitMenu() {
29 // User selector menu section. We don't show the user selector if there is 29 // User selector menu section. We don't show the user selector if there is
30 // only 1 user. 30 // only 1 user.
31 if (users_.size() > 1) { 31 if (users_.size() > 1) {
32 for (size_t i = 0; i < users_.size(); ++i) { 32 for (size_t i = 0; i < users_.size(); ++i) {
33 #if defined(OS_MACOSX) 33 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
34 menu_model_.AddRadioItem(SELECT_PROFILE + i,
35 users_[i].email.empty() ? users_[i].name
36 : users_[i].email,
37 0 /* group_id */);
38 #elif defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
39 menu_model_.AddItem(SELECT_PROFILE + i, users_[i].name); 34 menu_model_.AddItem(SELECT_PROFILE + i, users_[i].name);
40 int menu_index = menu_model_.GetIndexOfCommandId(SELECT_PROFILE + i); 35 int menu_index = menu_model_.GetIndexOfCommandId(SELECT_PROFILE + i);
41 menu_model_.SetSublabel(menu_index, users_[i].email); 36 menu_model_.SetSublabel(menu_index, users_[i].email);
42 // Use custom check mark. 37 // Use custom check mark.
43 if (users_[i].active) { 38 if (users_[i].active) {
44 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 39 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
45 menu_model_.SetIcon(menu_index, gfx::Image(*rb.GetImageSkiaNamed( 40 menu_model_.SetIcon(menu_index, gfx::Image(*rb.GetImageSkiaNamed(
46 IDR_APP_LIST_USER_INDICATOR))); 41 IDR_APP_LIST_USER_INDICATOR)));
47 } 42 }
48 #endif 43 #endif
49 } 44 }
50 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 45 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
51 } 46 }
52 47
53 menu_model_.AddItem(SHOW_HELP, l10n_util::GetStringUTF16( 48 menu_model_.AddItem(SHOW_HELP, l10n_util::GetStringUTF16(
54 IDS_APP_LIST_HELP)); 49 IDS_APP_LIST_HELP));
55 50
56 menu_model_.AddItem(SHOW_FEEDBACK, l10n_util::GetStringUTF16( 51 menu_model_.AddItem(SHOW_FEEDBACK, l10n_util::GetStringUTF16(
57 IDS_APP_LIST_OPEN_FEEDBACK)); 52 IDS_APP_LIST_OPEN_FEEDBACK));
58 } 53 }
59 54
60 bool AppListMenu::IsCommandIdChecked(int command_id) const { 55 bool AppListMenu::IsCommandIdChecked(int command_id) const {
61 #if defined(OS_MACOSX)
62 DCHECK_LT(static_cast<unsigned>(command_id) - SELECT_PROFILE, users_.size());
63 return users_[command_id - SELECT_PROFILE].active;
64 #else
65 return false; 56 return false;
66 #endif
67 } 57 }
68 58
69 bool AppListMenu::IsCommandIdEnabled(int command_id) const { 59 bool AppListMenu::IsCommandIdEnabled(int command_id) const {
70 return true; 60 return true;
71 } 61 }
72 62
73 void AppListMenu::ExecuteCommand(int command_id, int event_flags) { 63 void AppListMenu::ExecuteCommand(int command_id, int event_flags) {
74 if (command_id >= SELECT_PROFILE) { 64 if (command_id >= SELECT_PROFILE) {
75 delegate_->ShowForProfileByPath( 65 delegate_->ShowForProfileByPath(
76 users_[command_id - SELECT_PROFILE].profile_path); 66 users_[command_id - SELECT_PROFILE].profile_path);
77 return; 67 return;
78 } 68 }
79 switch (command_id) { 69 switch (command_id) {
80 case SHOW_HELP: 70 case SHOW_HELP:
81 delegate_->OpenHelp(); 71 delegate_->OpenHelp();
82 break; 72 break;
83 case SHOW_FEEDBACK: 73 case SHOW_FEEDBACK:
84 delegate_->OpenFeedback(); 74 delegate_->OpenFeedback();
85 break; 75 break;
86 default: 76 default:
87 NOTREACHED(); 77 NOTREACHED();
88 } 78 }
89 } 79 }
90 80
91 } // namespace app_list 81 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698