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

Side by Side Diff: ui/views/controls/menu/native_menu_win.cc

Issue 23769011: Move a bunch of windows stuff from ui/base/win to ui/gfx/win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar bustage. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/menu/menu_win.cc ('k') | ui/views/controls/native/native_view_host_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/menu/native_menu_win.h" 5 #include "ui/views/controls/menu/native_menu_win.h"
6 6
7 #include <Windowsx.h> 7 #include <Windowsx.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/win/wrapped_window_proc.h" 14 #include "base/win/wrapped_window_proc.h"
15 #include "ui/base/accelerators/accelerator.h" 15 #include "ui/base/accelerators/accelerator.h"
16 #include "ui/base/keycodes/keyboard_codes.h" 16 #include "ui/base/keycodes/keyboard_codes.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/l10n/l10n_util_win.h" 18 #include "ui/base/l10n/l10n_util_win.h"
19 #include "ui/base/models/menu_model.h" 19 #include "ui/base/models/menu_model.h"
20 #include "ui/base/win/hwnd_util.h"
21 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/font.h" 21 #include "ui/gfx/font.h"
23 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
24 #include "ui/gfx/image/image_skia.h" 23 #include "ui/gfx/image/image_skia.h"
25 #include "ui/gfx/rect.h" 24 #include "ui/gfx/rect.h"
25 #include "ui/gfx/win/hwnd_util.h"
26 #include "ui/native_theme/native_theme.h" 26 #include "ui/native_theme/native_theme.h"
27 #include "ui/native_theme/native_theme_win.h" 27 #include "ui/native_theme/native_theme_win.h"
28 #include "ui/views/controls/menu/menu_2.h" 28 #include "ui/views/controls/menu/menu_2.h"
29 #include "ui/views/controls/menu/menu_config.h" 29 #include "ui/views/controls/menu/menu_config.h"
30 #include "ui/views/controls/menu/menu_insertion_delegate_win.h" 30 #include "ui/views/controls/menu/menu_insertion_delegate_win.h"
31 #include "ui/views/controls/menu/menu_listener.h" 31 #include "ui/views/controls/menu/menu_listener.h"
32 32
33 using ui::NativeTheme; 33 using ui::NativeTheme;
34 34
35 namespace views { 35 namespace views {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 // A window that receives messages from Windows relevant to the native menu 76 // A window that receives messages from Windows relevant to the native menu
77 // structure we have constructed in NativeMenuWin. 77 // structure we have constructed in NativeMenuWin.
78 class NativeMenuWin::MenuHostWindow { 78 class NativeMenuWin::MenuHostWindow {
79 public: 79 public:
80 explicit MenuHostWindow(NativeMenuWin* parent) : parent_(parent) { 80 explicit MenuHostWindow(NativeMenuWin* parent) : parent_(parent) {
81 RegisterClass(); 81 RegisterClass();
82 hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName, 82 hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName,
83 L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); 83 L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
84 ui::CheckWindowCreated(hwnd_); 84 gfx::CheckWindowCreated(hwnd_);
85 ui::SetWindowUserData(hwnd_, this); 85 gfx::SetWindowUserData(hwnd_, this);
86 } 86 }
87 87
88 ~MenuHostWindow() { 88 ~MenuHostWindow() {
89 DestroyWindow(hwnd_); 89 DestroyWindow(hwnd_);
90 } 90 }
91 91
92 HWND hwnd() const { return hwnd_; } 92 HWND hwnd() const { return hwnd_; }
93 93
94 private: 94 private:
95 static const wchar_t* kWindowClassName; 95 static const wchar_t* kWindowClassName;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // TODO(beng): bring over owner draw from old menu system. 343 // TODO(beng): bring over owner draw from old menu system.
344 } 344 }
345 return false; 345 return false;
346 } 346 }
347 347
348 static LRESULT CALLBACK MenuHostWindowProc(HWND window, 348 static LRESULT CALLBACK MenuHostWindowProc(HWND window,
349 UINT message, 349 UINT message,
350 WPARAM w_param, 350 WPARAM w_param,
351 LPARAM l_param) { 351 LPARAM l_param) {
352 MenuHostWindow* host = 352 MenuHostWindow* host =
353 reinterpret_cast<MenuHostWindow*>(ui::GetWindowUserData(window)); 353 reinterpret_cast<MenuHostWindow*>(gfx::GetWindowUserData(window));
354 // host is null during initial construction. 354 // host is null during initial construction.
355 LRESULT l_result = 0; 355 LRESULT l_result = 0;
356 if (!host || !host->ProcessWindowMessage(window, message, w_param, l_param, 356 if (!host || !host->ProcessWindowMessage(window, message, w_param, l_param,
357 &l_result)) { 357 &l_result)) {
358 return DefWindowProc(window, message, w_param, l_param); 358 return DefWindowProc(window, message, w_param, l_param);
359 } 359 }
360 return l_result; 360 return l_result;
361 } 361 }
362 362
363 HWND hwnd_; 363 HWND hwnd_;
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 756
757 //////////////////////////////////////////////////////////////////////////////// 757 ////////////////////////////////////////////////////////////////////////////////
758 // MenuWrapper, public: 758 // MenuWrapper, public:
759 759
760 // static 760 // static
761 MenuWrapper* MenuWrapper::CreateWrapper(ui::MenuModel* model) { 761 MenuWrapper* MenuWrapper::CreateWrapper(ui::MenuModel* model) {
762 return new NativeMenuWin(model, NULL); 762 return new NativeMenuWin(model, NULL);
763 } 763 }
764 764
765 } // namespace views 765 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_win.cc ('k') | ui/views/controls/native/native_view_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698