summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/views/frame/browser_view.cc17
-rw-r--r--views/controls/menu/menu.h4
-rw-r--r--views/controls/menu/menu_win.cc5
3 files changed, 16 insertions, 10 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index bb213ac..4bf8e1d 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -56,14 +56,12 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "grit/webkit_resources.h"
-#include "views/controls/menu/menu_win.h"
+#include "views/controls/menu/menu.h"
#include "views/controls/scrollbar/native_scroll_bar.h"
#include "views/fill_layout.h"
#include "views/view.h"
#include "views/widget/root_view.h"
#include "views/window/non_client_view.h"
-#include "views/window/window_win.h"
-
using base::TimeDelta;
@@ -135,7 +133,7 @@ class ResizeCorner : public views::View {
ResizeCorner() { }
virtual void Paint(gfx::Canvas* canvas) {
- views::WindowWin* window = GetWindow();
+ views::Window* window = GetWindow();
if (!window || (window->IsMaximized() || window->IsFullscreen()))
return;
@@ -163,7 +161,7 @@ class ResizeCorner : public views::View {
}
virtual gfx::Size GetPreferredSize() {
- views::WindowWin* window = GetWindow();
+ views::Window* window = GetWindow();
return (!window || window->IsMaximized() || window->IsFullscreen()) ?
gfx::Size() : GetSize();
}
@@ -182,9 +180,9 @@ class ResizeCorner : public views::View {
private:
// Returns the WindowWin we're displayed in. Returns NULL if we're not
// currently in a window.
- views::WindowWin* GetWindow() {
+ views::Window* GetWindow() {
views::Widget* widget = GetWidget();
- return widget ? static_cast<views::WindowWin*>(widget) : NULL;
+ return widget ? widget->GetWindow() : NULL;
}
DISALLOW_COPY_AND_ASSIGN(ResizeCorner);
@@ -1300,9 +1298,8 @@ void BrowserView::Init() {
}
void BrowserView::InitSystemMenu() {
- HMENU system_menu = GetSystemMenu(frame_->GetWindow()->GetNativeWindow(),
- FALSE);
- system_menu_.reset(new views::MenuWin(system_menu));
+ system_menu_.reset(
+ views::Menu::GetSystemMenu(frame_->GetWindow()->GetNativeWindow()));
int insertion_index = std::max(0, system_menu_->ItemCount() - 1);
// We add the menu items in reverse order so that insertion_index never needs
// to change.
diff --git a/views/controls/menu/menu.h b/views/controls/menu/menu.h
index e07d7e5..0017ac1 100644
--- a/views/controls/menu/menu.h
+++ b/views/controls/menu/menu.h
@@ -180,6 +180,10 @@ class Menu {
AnchorPoint anchor,
gfx::NativeView parent);
+ // Creates a new menu with the contents of the system menu for the given
+ // parent window. The caller owns the returned pointer.
+ static Menu* GetSystemMenu(gfx::NativeView parent);
+
void set_delegate(Delegate* delegate) { delegate_ = delegate; }
Delegate* delegate() const { return delegate_; }
diff --git a/views/controls/menu/menu_win.cc b/views/controls/menu/menu_win.cc
index eab1816..84c3fac 100644
--- a/views/controls/menu/menu_win.cc
+++ b/views/controls/menu/menu_win.cc
@@ -236,6 +236,11 @@ Menu* Menu::Create(Delegate* delegate,
return new MenuWin(delegate, anchor, parent);
}
+// static
+Menu* Menu::GetSystemMenu(gfx::NativeView parent) {
+ return new views::MenuWin(::GetSystemMenu(parent, FALSE));
+}
+
MenuWin::MenuWin(Delegate* d, AnchorPoint anchor, HWND owner)
: Menu(d, anchor),
menu_(CreatePopupMenu()),