| 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/native_menu_win.h" | 5 #include "ui/views/controls/menu/native_menu_win.h" |
| 6 | 6 |
| 7 #include <Windowsx.h> | 7 #include <Windowsx.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 if (!owner_draw_) | 620 if (!owner_draw_) |
| 621 mii.fType = MFT_STRING; | 621 mii.fType = MFT_STRING; |
| 622 else | 622 else |
| 623 mii.fType = MFT_OWNERDRAW; | 623 mii.fType = MFT_OWNERDRAW; |
| 624 | 624 |
| 625 ItemData* item_data = new ItemData; | 625 ItemData* item_data = new ItemData; |
| 626 item_data->label = string16(); | 626 item_data->label = string16(); |
| 627 ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); | 627 ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); |
| 628 if (type == ui::MenuModel::TYPE_SUBMENU) { | 628 if (type == ui::MenuModel::TYPE_SUBMENU) { |
| 629 item_data->submenu.reset( | 629 item_data->submenu.reset( |
| 630 new NativeMenuWin(model_->GetSubmenuModelAt(model_index), NULL)); | 630 new NativeMenuWin(model_->GetSubmenuModelAt(model_index), |
| 631 system_menu_for_)); |
| 631 mii.fMask |= MIIM_SUBMENU; | 632 mii.fMask |= MIIM_SUBMENU; |
| 632 mii.hSubMenu = item_data->submenu->GetNativeMenu(); | 633 mii.hSubMenu = item_data->submenu->GetNativeMenu(); |
| 633 GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this; | 634 GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this; |
| 634 } else { | 635 } else { |
| 635 if (type == ui::MenuModel::TYPE_RADIO) | 636 if (type == ui::MenuModel::TYPE_RADIO) |
| 636 mii.fType |= MFT_RADIOCHECK; | 637 mii.fType |= MFT_RADIOCHECK; |
| 637 mii.wID = model_->GetCommandIdAt(model_index); | 638 mii.wID = model_->GetCommandIdAt(model_index); |
| 638 } | 639 } |
| 639 item_data->native_menu_win = this; | 640 item_data->native_menu_win = this; |
| 640 item_data->model_index = model_index; | 641 item_data->model_index = model_index; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 746 |
| 746 void NativeMenuWin::CreateHostWindow() { | 747 void NativeMenuWin::CreateHostWindow() { |
| 747 // This only gets called from RunMenuAt, and as such there is only ever one | 748 // This only gets called from RunMenuAt, and as such there is only ever one |
| 748 // host window per menu hierarchy, no matter how many NativeMenuWin objects | 749 // host window per menu hierarchy, no matter how many NativeMenuWin objects |
| 749 // exist wrapping submenus. | 750 // exist wrapping submenus. |
| 750 if (!host_window_.get()) | 751 if (!host_window_.get()) |
| 751 host_window_.reset(new MenuHostWindow(this)); | 752 host_window_.reset(new MenuHostWindow(this)); |
| 752 } | 753 } |
| 753 | 754 |
| 754 } // namespace views | 755 } // namespace views |
| OLD | NEW |