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/models/menu_model.h" | 8 #include "ui/base/models/menu_model.h" |
9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
10 #include "ui/views/controls/menu/menu_item_view.h" | 10 #include "ui/views/controls/menu/menu_item_view.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 const std::map<MenuItemView*, ui::MenuModel*>::const_iterator map_iterator = | 262 const std::map<MenuItemView*, ui::MenuModel*>::const_iterator map_iterator = |
263 menu_map_.find(menu); | 263 menu_map_.find(menu); |
264 if (map_iterator != menu_map_.end()) { | 264 if (map_iterator != menu_map_.end()) { |
265 map_iterator->second->MenuWillClose(); | 265 map_iterator->second->MenuWillClose(); |
266 return; | 266 return; |
267 } | 267 } |
268 | 268 |
269 NOTREACHED(); | 269 NOTREACHED(); |
270 } | 270 } |
271 | 271 |
272 void MenuModelAdapter::OnMenuClosed(MenuItemView* menu, | 272 void MenuModelAdapter::OnMenuClosed(MenuItemView* menu) { |
273 MenuRunner::RunResult result) { | |
274 if (!on_menu_closed_callback_.is_null()) | 273 if (!on_menu_closed_callback_.is_null()) |
275 on_menu_closed_callback_.Run(); | 274 on_menu_closed_callback_.Run(); |
276 } | 275 } |
277 | 276 |
278 // MenuModelAdapter, private: | 277 // MenuModelAdapter, private: |
279 | 278 |
280 void MenuModelAdapter::BuildMenuImpl(MenuItemView* menu, ui::MenuModel* model) { | 279 void MenuModelAdapter::BuildMenuImpl(MenuItemView* menu, ui::MenuModel* model) { |
281 DCHECK(menu); | 280 DCHECK(menu); |
282 DCHECK(model); | 281 DCHECK(model); |
283 bool has_icons = model->HasIcons(); | 282 bool has_icons = model->HasIcons(); |
(...skipping 10 matching lines...) Expand all Loading... |
294 has_icons = has_icons || item->has_icons(); | 293 has_icons = has_icons || item->has_icons(); |
295 | 294 |
296 menu_map_[item] = submodel; | 295 menu_map_[item] = submodel; |
297 } | 296 } |
298 } | 297 } |
299 | 298 |
300 menu->set_has_icons(has_icons); | 299 menu->set_has_icons(has_icons); |
301 } | 300 } |
302 | 301 |
303 } // namespace views | 302 } // namespace views |
OLD | NEW |