diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-26 18:25:18 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-26 18:25:18 +0000 |
commit | 28548f7b3206c75fc544b0ccd3efaa34d2c1072c (patch) | |
tree | 34d402b3844ebf746511627ceafb2e8ef125c133 /views/controls | |
parent | 5097e2d21a11e4f29875c2d66489832311e5038f (diff) | |
download | chromium_src-28548f7b3206c75fc544b0ccd3efaa34d2c1072c.zip chromium_src-28548f7b3206c75fc544b0ccd3efaa34d2c1072c.tar.gz chromium_src-28548f7b3206c75fc544b0ccd3efaa34d2c1072c.tar.bz2 |
menu: Rename NativeMenuLinux to NativeMenuViews, and use it for aura.
This also fixes component build for aura_shell.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8036027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/menu/native_menu_aura.cc | 69 | ||||
-rw-r--r-- | views/controls/menu/native_menu_views.cc (renamed from views/controls/menu/native_menu_linux.cc) | 38 | ||||
-rw-r--r-- | views/controls/menu/native_menu_views.h (renamed from views/controls/menu/native_menu_linux.h) | 10 |
3 files changed, 24 insertions, 93 deletions
diff --git a/views/controls/menu/native_menu_aura.cc b/views/controls/menu/native_menu_aura.cc deleted file mode 100644 index 602e9d1..0000000 --- a/views/controls/menu/native_menu_aura.cc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "views/controls/menu/native_menu_linux.h" - -#include "base/logging.h" -#include "views/controls/menu/menu_2.h" -#include "views/controls/menu/menu_listener.h" -#include "views/controls/menu/menu_wrapper.h" - -namespace views { - -class NativeMenuAura : public MenuWrapper { -public: - explicit NativeMenuAura(Menu2* menu) {} - virtual ~NativeMenuAura() {} - - // Overridden from MenuWrapper: - virtual void RunMenuAt(const gfx::Point& point, int alignment) OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual void CancelMenu() OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual void Rebuild() OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual void UpdateStates() OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual gfx::NativeMenu GetNativeMenu() const OVERRIDE { - NOTIMPLEMENTED(); - return NULL; - } - - virtual MenuWrapper::MenuAction GetMenuAction() const OVERRIDE { - NOTIMPLEMENTED(); - return MENU_ACTION_NONE; - } - - virtual void AddMenuListener(MenuListener* listener) OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual void RemoveMenuListener(MenuListener* listener) OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual void SetMinimumWidth(int width) OVERRIDE { - NOTIMPLEMENTED(); - } - - private: - DISALLOW_COPY_AND_ASSIGN(NativeMenuAura); -}; - -// MenuWrapper, public: - -// static -MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { - return new NativeMenuAura(menu); -} - -} // namespace views diff --git a/views/controls/menu/native_menu_linux.cc b/views/controls/menu/native_menu_views.cc index 5053fc8..9fe5ee8 100644 --- a/views/controls/menu/native_menu_linux.cc +++ b/views/controls/menu/native_menu_views.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "views/controls/menu/native_menu_linux.h" +#include "views/controls/menu/native_menu_views.h" #include "base/logging.h" #include "base/utf_string_conversions.h" @@ -17,17 +17,17 @@ namespace views { -NativeMenuLinux::NativeMenuLinux(Menu2* menu) +NativeMenuViews::NativeMenuViews(Menu2* menu) : model_(menu->model()), ALLOW_THIS_IN_INITIALIZER_LIST(root_(new MenuItemView(this))), menu_runner_(new MenuRunner(root_)) { } -NativeMenuLinux::~NativeMenuLinux() { +NativeMenuViews::~NativeMenuViews() { } // MenuWrapper implementation: -void NativeMenuLinux::RunMenuAt(const gfx::Point& point, int alignment) { +void NativeMenuViews::RunMenuAt(const gfx::Point& point, int alignment) { // TODO: this should really return the value from MenuRunner. UpdateStates(); if (menu_runner_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()), @@ -37,46 +37,46 @@ void NativeMenuLinux::RunMenuAt(const gfx::Point& point, int alignment) { return; } -void NativeMenuLinux::CancelMenu() { +void NativeMenuViews::CancelMenu() { NOTIMPLEMENTED(); } -void NativeMenuLinux::Rebuild() { +void NativeMenuViews::Rebuild() { if (SubmenuView* submenu = root_->GetSubmenu()) submenu->RemoveAllChildViews(true); AddMenuItemsFromModel(root_, model_); } -void NativeMenuLinux::UpdateStates() { +void NativeMenuViews::UpdateStates() { SubmenuView* submenu = root_->CreateSubmenu(); UpdateMenuFromModel(submenu, model_); } -gfx::NativeMenu NativeMenuLinux::GetNativeMenu() const { +gfx::NativeMenu NativeMenuViews::GetNativeMenu() const { NOTIMPLEMENTED(); return NULL; } -MenuWrapper::MenuAction NativeMenuLinux::GetMenuAction() const { +MenuWrapper::MenuAction NativeMenuViews::GetMenuAction() const { NOTIMPLEMENTED(); return MENU_ACTION_NONE; } -void NativeMenuLinux::AddMenuListener(MenuListener* listener) { +void NativeMenuViews::AddMenuListener(MenuListener* listener) { NOTIMPLEMENTED(); } -void NativeMenuLinux::RemoveMenuListener(MenuListener* listener) { +void NativeMenuViews::RemoveMenuListener(MenuListener* listener) { NOTIMPLEMENTED(); } -void NativeMenuLinux::SetMinimumWidth(int width) { +void NativeMenuViews::SetMinimumWidth(int width) { NOTIMPLEMENTED(); } // MenuDelegate implementation -bool NativeMenuLinux::IsItemChecked(int cmd) const { +bool NativeMenuViews::IsItemChecked(int cmd) const { int index; ui::MenuModel* model = model_; if (!ui::MenuModel::GetModelAndIndexForCommandId(cmd, &model, &index)) @@ -84,7 +84,7 @@ bool NativeMenuLinux::IsItemChecked(int cmd) const { return model->IsItemCheckedAt(index); } -bool NativeMenuLinux::IsCommandEnabled(int cmd) const { +bool NativeMenuViews::IsCommandEnabled(int cmd) const { int index; ui::MenuModel* model = model_; if (!ui::MenuModel::GetModelAndIndexForCommandId(cmd, &model, &index)) @@ -92,7 +92,7 @@ bool NativeMenuLinux::IsCommandEnabled(int cmd) const { return model->IsEnabledAt(index); } -void NativeMenuLinux::ExecuteCommand(int cmd) { +void NativeMenuViews::ExecuteCommand(int cmd) { int index; ui::MenuModel* model = model_; if (!ui::MenuModel::GetModelAndIndexForCommandId(cmd, &model, &index)) @@ -100,7 +100,7 @@ void NativeMenuLinux::ExecuteCommand(int cmd) { model->ActivatedAt(index); } -bool NativeMenuLinux::GetAccelerator(int id, views::Accelerator* accelerator) { +bool NativeMenuViews::GetAccelerator(int id, views::Accelerator* accelerator) { int index; ui::MenuModel* model = model_; if (!ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) @@ -116,7 +116,7 @@ bool NativeMenuLinux::GetAccelerator(int id, views::Accelerator* accelerator) { } // private -void NativeMenuLinux::AddMenuItemsFromModel(MenuItemView* parent, +void NativeMenuViews::AddMenuItemsFromModel(MenuItemView* parent, ui::MenuModel* model) { for (int i = 0; i < model->GetItemCount(); ++i) { int index = i + model->GetFirstItemIndex(NULL); @@ -129,7 +129,7 @@ void NativeMenuLinux::AddMenuItemsFromModel(MenuItemView* parent, } } -void NativeMenuLinux::UpdateMenuFromModel(SubmenuView* menu, +void NativeMenuViews::UpdateMenuFromModel(SubmenuView* menu, ui::MenuModel* model) { for (int i = 0, sep = 0; i < model->GetItemCount(); ++i) { int index = i + model->GetFirstItemIndex(NULL); @@ -165,7 +165,7 @@ void NativeMenuLinux::UpdateMenuFromModel(SubmenuView* menu, // static MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { - return new NativeMenuLinux(menu); + return new NativeMenuViews(menu); } } // namespace views diff --git a/views/controls/menu/native_menu_linux.h b/views/controls/menu/native_menu_views.h index 131080d..75e9100 100644 --- a/views/controls/menu/native_menu_linux.h +++ b/views/controls/menu/native_menu_views.h @@ -21,12 +21,12 @@ namespace views { class MenuItemView; class MenuRunner; -// A non-GTK implementation of MenuWrapper, used currently for touchui. -class NativeMenuLinux : public MenuWrapper, +// A views implementation of MenuWrapper, used currently for touchui. +class NativeMenuViews : public MenuWrapper, public MenuDelegate { public: - explicit NativeMenuLinux(Menu2* menu); - virtual ~NativeMenuLinux(); + explicit NativeMenuViews(Menu2* menu); + virtual ~NativeMenuViews(); // Overridden from MenuWrapper: virtual void RunMenuAt(const gfx::Point& point, int alignment) OVERRIDE; @@ -54,7 +54,7 @@ class NativeMenuLinux : public MenuWrapper, MenuItemView* root_; scoped_ptr<MenuRunner> menu_runner_; - DISALLOW_COPY_AND_ASSIGN(NativeMenuLinux); + DISALLOW_COPY_AND_ASSIGN(NativeMenuViews); }; } // namespace views |