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 3 // found in the LICENSE file. 4 5 #include "libcef/browser/native/menu_2.h" 6 7 #include "ui/base/models/menu_model.h" 8 9 namespace views { 10 Menu2(ui::MenuModel * model)11Menu2::Menu2(ui::MenuModel* model) 12 : model_(model), wrapper_(MenuWrapper::CreateWrapper(model)) { 13 Rebuild(); 14 } 15 ~Menu2()16Menu2::~Menu2() {} 17 GetNativeMenu() const18HMENU Menu2::GetNativeMenu() const { 19 return wrapper_->GetNativeMenu(); 20 } 21 RunMenuAt(const gfx::Point & point,Alignment alignment)22void Menu2::RunMenuAt(const gfx::Point& point, Alignment alignment) { 23 wrapper_->RunMenuAt(point, alignment); 24 } 25 RunContextMenuAt(const gfx::Point & point)26void Menu2::RunContextMenuAt(const gfx::Point& point) { 27 RunMenuAt(point, ALIGN_TOPLEFT); 28 } 29 CancelMenu()30void Menu2::CancelMenu() { 31 wrapper_->CancelMenu(); 32 } 33 Rebuild()34void Menu2::Rebuild() { 35 wrapper_->Rebuild(nullptr); 36 } 37 UpdateStates()38void Menu2::UpdateStates() { 39 wrapper_->UpdateStates(); 40 } 41 GetMenuAction() const42MenuWrapper::MenuAction Menu2::GetMenuAction() const { 43 return wrapper_->GetMenuAction(); 44 } 45 SetMinimumWidth(int width)46void Menu2::SetMinimumWidth(int width) { 47 wrapper_->SetMinimumWidth(width); 48 } 49 50 } // namespace views 51