| OLD | NEW | 
|   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_recorder.h" |   7 #include "ash/metrics/user_metrics_recorder.h" | 
|   8 #include "ash/shelf/shelf.h" |   8 #include "ash/shelf/shelf.h" | 
|   9 #include "ash/shelf/shelf_layout_manager.h" |  | 
|  10 #include "ash/shelf/shelf_types.h" |   9 #include "ash/shelf/shelf_types.h" | 
|  11 #include "ash/shelf/shelf_widget.h" |  | 
|  12 #include "ash/shell.h" |  10 #include "ash/shell.h" | 
|  13 #include "grit/ash_strings.h" |  11 #include "grit/ash_strings.h" | 
|  14 #include "ui/aura/window.h" |  12 #include "ui/aura/window.h" | 
|  15  |  13  | 
|  16 namespace ash { |  14 namespace ash { | 
|  17  |  15  | 
|  18 ShelfAlignmentMenu::ShelfAlignmentMenu(Shelf* shelf) |  16 ShelfAlignmentMenu::ShelfAlignmentMenu(Shelf* shelf) | 
|  19     : ui::SimpleMenuModel(nullptr), shelf_(shelf) { |  17     : ui::SimpleMenuModel(nullptr), shelf_(shelf) { | 
|  20   DCHECK(shelf_); |  18   DCHECK(shelf_); | 
|  21   int align_group_id = 1; |  19   int align_group_id = 1; | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
|  44 } |  42 } | 
|  45  |  43  | 
|  46 bool ShelfAlignmentMenu::GetAcceleratorForCommandId( |  44 bool ShelfAlignmentMenu::GetAcceleratorForCommandId( | 
|  47     int command_id, |  45     int command_id, | 
|  48     ui::Accelerator* accelerator) { |  46     ui::Accelerator* accelerator) { | 
|  49   return false; |  47   return false; | 
|  50 } |  48 } | 
|  51  |  49  | 
|  52 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { |  50 void ShelfAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { | 
|  53   Shell* shell = Shell::GetInstance(); |  51   Shell* shell = Shell::GetInstance(); | 
|  54   ShelfLayoutManager* manager = shelf_->shelf_widget()->shelf_layout_manager(); |  | 
|  55   switch (static_cast<MenuItem>(command_id)) { |  52   switch (static_cast<MenuItem>(command_id)) { | 
|  56     case MENU_ALIGN_LEFT: |  53     case MENU_ALIGN_LEFT: | 
|  57       shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); |  54       shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_LEFT); | 
|  58       manager->SetAlignment(SHELF_ALIGNMENT_LEFT); |  55       shelf_->SetAlignment(SHELF_ALIGNMENT_LEFT); | 
|  59       break; |  56       break; | 
|  60     case MENU_ALIGN_BOTTOM: |  57     case MENU_ALIGN_BOTTOM: | 
|  61       shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); |  58       shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_BOTTOM); | 
|  62       manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |  59       shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 
|  63       break; |  60       break; | 
|  64     case MENU_ALIGN_RIGHT: |  61     case MENU_ALIGN_RIGHT: | 
|  65       shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); |  62       shell->metrics()->RecordUserMetricsAction(UMA_SHELF_ALIGNMENT_SET_RIGHT); | 
|  66       manager->SetAlignment(SHELF_ALIGNMENT_RIGHT); |  63       shelf_->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 
|  67       break; |  64       break; | 
|  68   } |  65   } | 
|  69 } |  66 } | 
|  70  |  67  | 
|  71 }  // namespace ash |  68 }  // namespace ash | 
| OLD | NEW |