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

Side by Side Diff: trunk/src/ui/views/controls/menu/native_menu_win.cc

Issue 14188051: Revert 195033 "views: Fix crash in NativeMenuWin::AddMenuItemAt()." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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), 630 new NativeMenuWin(model_->GetSubmenuModelAt(model_index), NULL));
631 system_menu_for_));
632 mii.fMask |= MIIM_SUBMENU; 631 mii.fMask |= MIIM_SUBMENU;
633 mii.hSubMenu = item_data->submenu->GetNativeMenu(); 632 mii.hSubMenu = item_data->submenu->GetNativeMenu();
634 GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this; 633 GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this;
635 } else { 634 } else {
636 if (type == ui::MenuModel::TYPE_RADIO) 635 if (type == ui::MenuModel::TYPE_RADIO)
637 mii.fType |= MFT_RADIOCHECK; 636 mii.fType |= MFT_RADIOCHECK;
638 mii.wID = model_->GetCommandIdAt(model_index); 637 mii.wID = model_->GetCommandIdAt(model_index);
639 } 638 }
640 item_data->native_menu_win = this; 639 item_data->native_menu_win = this;
641 item_data->model_index = model_index; 640 item_data->model_index = model_index;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 745
747 void NativeMenuWin::CreateHostWindow() { 746 void NativeMenuWin::CreateHostWindow() {
748 // This only gets called from RunMenuAt, and as such there is only ever one 747 // This only gets called from RunMenuAt, and as such there is only ever one
749 // host window per menu hierarchy, no matter how many NativeMenuWin objects 748 // host window per menu hierarchy, no matter how many NativeMenuWin objects
750 // exist wrapping submenus. 749 // exist wrapping submenus.
751 if (!host_window_.get()) 750 if (!host_window_.get())
752 host_window_.reset(new MenuHostWindow(this)); 751 host_window_.reset(new MenuHostWindow(this));
753 } 752 }
754 753
755 } // namespace views 754 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698