diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 17:09:35 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 17:09:35 +0000 |
commit | ce7db337437bb826f5081ab784a7ccda2916dbd7 (patch) | |
tree | dd5c20cdd6934cf8b3f006a21a8868c87efccc43 /ui/views/controls | |
parent | 3cfa2facc0fc69dda97d470e08a83ffa5a183f9a (diff) | |
download | chromium_src-ce7db337437bb826f5081ab784a7ccda2916dbd7.zip chromium_src-ce7db337437bb826f5081ab784a7ccda2916dbd7.tar.gz chromium_src-ce7db337437bb826f5081ab784a7ccda2916dbd7.tar.bz2 |
views: Extract SystemMenuModel from native_menu_win.*.
This patch moves a model used by BrowserFrameWin near where it's really used,
and into a place that looks more appropriated, which is to frame/ directory,
near to system_menu_model_delegate.*.
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9966007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls')
-rw-r--r-- | ui/views/controls/menu/native_menu_win.cc | 16 | ||||
-rw-r--r-- | ui/views/controls/menu/native_menu_win.h | 26 |
2 files changed, 7 insertions, 35 deletions
diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc index aa4adbd..1d518ea 100644 --- a/ui/views/controls/menu/native_menu_win.cc +++ b/ui/views/controls/menu/native_menu_win.cc @@ -17,6 +17,7 @@ #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_win.h" +#include "ui/base/models/menu_model.h" #include "ui/base/win/hwnd_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" @@ -739,21 +740,6 @@ void NativeMenuWin::CreateHostWindow() { } //////////////////////////////////////////////////////////////////////////////// -// SystemMenuModel: - -SystemMenuModel::SystemMenuModel(ui::SimpleMenuModel::Delegate* delegate) - : SimpleMenuModel(delegate) { -} - -SystemMenuModel::~SystemMenuModel() { -} - -int SystemMenuModel::GetFirstItemIndex(gfx::NativeMenu native_menu) const { - // We allow insertions before last item (Close). - return std::max(0, GetMenuItemCount(native_menu) - 1); -} - -//////////////////////////////////////////////////////////////////////////////// // MenuWrapper, public: // static diff --git a/ui/views/controls/menu/native_menu_win.h b/ui/views/controls/menu/native_menu_win.h index 08e07ba..c4b5543 100644 --- a/ui/views/controls/menu/native_menu_win.h +++ b/ui/views/controls/menu/native_menu_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -13,10 +13,14 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "ui/base/models/simple_menu_model.h" +#include "base/string16.h" #include "ui/views/controls/menu/menu_wrapper.h" #include "ui/views/views_export.h" +namespace ui { +class MenuModel; +} + namespace views { // A Windows implementation of MenuWrapper. @@ -161,24 +165,6 @@ class VIEWS_EXPORT NativeMenuWin : public MenuWrapper { DISALLOW_COPY_AND_ASSIGN(NativeMenuWin); }; -// A SimpleMenuModel subclass that allows the system menu for a window to be -// wrapped. -class VIEWS_EXPORT SystemMenuModel : public ui::SimpleMenuModel { - public: - explicit SystemMenuModel(Delegate* delegate); - virtual ~SystemMenuModel(); - - // Overridden from ui::MenuModel: - virtual int GetFirstItemIndex(gfx::NativeMenu native_menu) const; - - protected: - // Overridden from SimpleMenuModel: - virtual int FlipIndex(int index) const { return GetItemCount() - index - 1; } - - private: - DISALLOW_COPY_AND_ASSIGN(SystemMenuModel); -}; - } // namespace views #endif // UI_VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ |