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

Side by Side Diff: ash/shelf/shelf_alignment_menu.cc

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 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 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 "ash/shelf/shelf_alignment_menu.h" 5 #include "ash/shelf/shelf_alignment_menu.h"
6 6
7 #include "ash/metrics/user_metrics_action.h" 7 #include "ash/metrics/user_metrics_action.h"
8 #include "ash/public/cpp/shelf_types.h" 8 #include "ash/public/cpp/shelf_types.h"
9 #include "ash/shelf/wm_shelf.h" 9 #include "ash/shelf/wm_shelf.h"
10 #include "ash/shell_port.h"
10 #include "ash/strings/grit/ash_strings.h" 11 #include "ash/strings/grit/ash_strings.h"
11 #include "ash/wm_shell.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 ShelfAlignmentMenu::ShelfAlignmentMenu(WmShelf* wm_shelf) 15 ShelfAlignmentMenu::ShelfAlignmentMenu(WmShelf* wm_shelf)
16 : ui::SimpleMenuModel(nullptr), wm_shelf_(wm_shelf) { 16 : ui::SimpleMenuModel(nullptr), wm_shelf_(wm_shelf) {
17 DCHECK(wm_shelf_); 17 DCHECK(wm_shelf_);
18 const int align_group_id = 1; 18 const int align_group_id = 1;
19 set_delegate(this); 19 set_delegate(this);
20 AddRadioItemWithStringId( 20 AddRadioItemWithStringId(
21 MENU_ALIGN_LEFT, IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_LEFT, align_group_id); 21 MENU_ALIGN_LEFT, IDS_ASH_SHELF_CONTEXT_MENU_ALIGN_LEFT, align_group_id);
(...skipping 17 matching lines...) Expand all
39 return command_id == MENU_ALIGN_RIGHT; 39 return command_id == MENU_ALIGN_RIGHT;
40 } 40 }
41 return false; 41 return false;
42 } 42 }
43 43
44 bool ShelfAlignmentMenu::IsCommandIdEnabled(int command_id) const { 44 bool ShelfAlignmentMenu::IsCommandIdEnabled(int command_id) const {
45 return true; 45 return true;
46 } 46 }
47 47
48 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { 48 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) {
49 WmShell* shell = WmShell::Get();
50 switch (static_cast<MenuItem>(command_id)) { 49 switch (static_cast<MenuItem>(command_id)) {
51 case MENU_ALIGN_LEFT: 50 case MENU_ALIGN_LEFT:
52 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); 51 ShellPort::Get()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT);
53 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); 52 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT);
54 break; 53 break;
55 case MENU_ALIGN_BOTTOM: 54 case MENU_ALIGN_BOTTOM:
56 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); 55 ShellPort::Get()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM);
57 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); 56 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
58 break; 57 break;
59 case MENU_ALIGN_RIGHT: 58 case MENU_ALIGN_RIGHT:
60 shell->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); 59 ShellPort::Get()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT);
61 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); 60 wm_shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT);
62 break; 61 break;
63 } 62 }
64 } 63 }
65 64
66 } // namespace ash 65 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698