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

Unified Diff: views/controls/menu/menu_win.cc

Issue 199070: Use base::WindowImpl instead of CWindowImpl to remove a dependency on ATL.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_win.cc
===================================================================
--- views/controls/menu/menu_win.cc (revision 25700)
+++ views/controls/menu/menu_win.cc (working copy)
@@ -4,12 +4,6 @@
#include "views/controls/menu/menu_win.h"
-#include <atlbase.h>
-#include <atlapp.h>
-#include <atlwin.h>
-#include <atlcrack.h>
-#include <atlframe.h>
-#include <atlmisc.h>
#include <string>
#include "app/gfx/canvas.h"
@@ -20,6 +14,7 @@
#include "base/logging.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
+#include "base/window_impl.h"
#include "views/accelerator.h"
namespace views {
@@ -51,7 +46,7 @@
namespace {
static int ChromeGetMenuItemID(HMENU hMenu, int pos) {
- // The built-in Windows ::GetMenuItemID doesn't work for submenus,
+ // The built-in Windows GetMenuItemID doesn't work for submenus,
// so here's our own implementation.
MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);
@@ -66,8 +61,7 @@
// to intercept right clicks on the HMENU and notify the delegate as well as
// for drawing icons.
//
-class MenuHostWindow : public CWindowImpl<MenuHostWindow, CWindow,
- CWinTraits<WS_CHILD>> {
+class MenuHostWindow : public base::WindowImpl {
public:
MenuHostWindow(MenuWin* menu, HWND parent_window) : menu_(menu) {
int extended_style = 0;
@@ -76,15 +70,16 @@
// underlying HWND.
if (menu_->delegate()->IsRightToLeftUILayout())
extended_style |= l10n_util::GetExtendedStyles();
- Create(parent_window, gfx::Rect().ToRECT(), 0, 0, extended_style);
+ set_window_style(WS_CHILD);
+ set_window_ex_style(extended_style);
+ Init(parent_window, gfx::Rect());
}
~MenuHostWindow() {
- DestroyWindow();
+ DestroyWindow(hwnd());
}
- DECLARE_FRAME_WND_CLASS(L"MenuHostWindow", NULL);
- BEGIN_MSG_MAP(MenuHostWindow);
+ BEGIN_MSG_MAP_EX(MenuHostWindow);
MSG_WM_RBUTTONUP(OnRButtonUp)
MSG_WM_MEASUREITEM(OnMeasureItem)
MSG_WM_DRAWITEM(OnDrawItem)
@@ -367,7 +362,7 @@
active_host_window = new MenuHostWindow(this, owner_);
}
UINT selected_id =
- TrackPopupMenuEx(menu_, flags, x, y, active_host_window->m_hWnd, NULL);
+ TrackPopupMenuEx(menu_, flags, x, y, active_host_window->hwnd(), NULL);
if (created_host) {
delete active_host_window;
active_host_window = NULL;
« 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