| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/controls/menu/menu_model_adapter.h" | 5 #include "ui/views/controls/menu/menu_model_adapter.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "ui/base/l10n/l10n_util.h" | 8 #include "ui/base/l10n/l10n_util.h" | 
| 9 #include "ui/base/models/menu_model.h" | 9 #include "ui/base/models/menu_model.h" | 
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" | 
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 155 } | 155 } | 
| 156 | 156 | 
| 157 bool MenuModelAdapter::IsTriggerableEvent(MenuItemView* source, | 157 bool MenuModelAdapter::IsTriggerableEvent(MenuItemView* source, | 
| 158                                           const ui::Event& e) { | 158                                           const ui::Event& e) { | 
| 159   return e.type() == ui::ET_GESTURE_TAP || | 159   return e.type() == ui::ET_GESTURE_TAP || | 
| 160          e.type() == ui::ET_GESTURE_TAP_DOWN || | 160          e.type() == ui::ET_GESTURE_TAP_DOWN || | 
| 161          (e.IsMouseEvent() && (triggerable_event_flags_ & e.flags()) != 0); | 161          (e.IsMouseEvent() && (triggerable_event_flags_ & e.flags()) != 0); | 
| 162 } | 162 } | 
| 163 | 163 | 
| 164 bool MenuModelAdapter::GetAccelerator(int id, | 164 bool MenuModelAdapter::GetAccelerator(int id, | 
| 165                                       ui::Accelerator* accelerator) { | 165                                       ui::Accelerator* accelerator) const { | 
| 166   ui::MenuModel* model = menu_model_; | 166   ui::MenuModel* model = menu_model_; | 
| 167   int index = 0; | 167   int index = 0; | 
| 168   if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) | 168   if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) | 
| 169     return model->GetAcceleratorAt(index, accelerator); | 169     return model->GetAcceleratorAt(index, accelerator); | 
| 170 | 170 | 
| 171   NOTREACHED(); | 171   NOTREACHED(); | 
| 172   return false; | 172   return false; | 
| 173 } | 173 } | 
| 174 | 174 | 
| 175 base::string16 MenuModelAdapter::GetLabel(int id) const { | 175 base::string16 MenuModelAdapter::GetLabel(int id) const { | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 277       has_icons = has_icons || item->has_icons(); | 277       has_icons = has_icons || item->has_icons(); | 
| 278 | 278 | 
| 279       menu_map_[item] = submodel; | 279       menu_map_[item] = submodel; | 
| 280     } | 280     } | 
| 281   } | 281   } | 
| 282 | 282 | 
| 283   menu->set_has_icons(has_icons); | 283   menu->set_has_icons(has_icons); | 
| 284 } | 284 } | 
| 285 | 285 | 
| 286 }  // namespace views | 286 }  // namespace views | 
| OLD | NEW | 
|---|