summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 16:37:25 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 16:37:25 +0000
commitbd6d89573285fade02c903449747a80b2981b536 (patch)
tree1024938ac74d8c8e53675eec4a694891b7e26426 /ui
parentc066687506afd59db2de32ffda2ea0ae30f5cbfb (diff)
downloadchromium_src-bd6d89573285fade02c903449747a80b2981b536.zip
chromium_src-bd6d89573285fade02c903449747a80b2981b536.tar.gz
chromium_src-bd6d89573285fade02c903449747a80b2981b536.tar.bz2
Revert 154440 - Make HWNDMessageHandler build with use_aura==1
http://crbug.com/142962 R=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10918015 TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/10907031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154444 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.gyp6
-rw-r--r--ui/views/views.gyp11
-rw-r--r--ui/views/widget/native_widget_win.cc47
-rw-r--r--ui/views/widget/native_widget_win.h7
-rw-r--r--ui/views/win/DEPS1
-rw-r--r--ui/views/win/hwnd_message_handler.cc79
-rw-r--r--ui/views/win/hwnd_message_handler.h3
-rw-r--r--ui/views/win/hwnd_message_handler_delegate.h20
8 files changed, 67 insertions, 107 deletions
diff --git a/ui/ui.gyp b/ui/ui.gyp
index 69e7be7..4f1bdb7 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -517,6 +517,8 @@
['exclude', 'base/dialogs/select_file_dialog_mac.mm'],
['exclude', 'base/dialogs/select_file_dialog_win.cc'],
['exclude', 'base/dragdrop/drag_utils_win.cc'],
+ ['exclude', 'base/win/mouse_wheel_util.cc'],
+ ['exclude', 'base/win/mouse_wheel_util.h'],
['exclude', 'base/work_area_watcher_observer.h'],
['exclude', 'base/x/active_window_watcher_x.cc'],
['exclude', 'base/x/active_window_watcher_x.h'],
@@ -541,8 +543,8 @@
'sources/': [
['exclude', 'base/dragdrop/os_exchange_data_provider_win.cc'],
['exclude', 'base/dragdrop/os_exchange_data_provider_win.h'],
- ['exclude', 'base/native_theme/native_theme_aura.cc'],
- ['exclude', 'base/native_theme/native_theme_aura.h'],
+ ['exclude', 'base/native_theme/native_theme_win.cc'],
+ ['exclude', 'base/native_theme/native_theme_win.h'],
['exclude', 'gfx/path_win.cc'],
],
}],
diff --git a/ui/views/views.gyp b/ui/views/views.gyp
index 12f7551..20f49ce 100644
--- a/ui/views/views.gyp
+++ b/ui/views/views.gyp
@@ -453,6 +453,17 @@
'widget/widget_message_filter.h',
],
}],
+ ['use_aura==1 or OS!="win"', {
+ 'sources!': [
+ 'win/fullscreen_handler.cc',
+ 'win/fullscreen_handler.h',
+ 'win/hwnd_message_handler.cc',
+ 'win/hwnd_message_handler.h',
+ 'win/hwnd_message_handler_delegate.h',
+ 'win/scoped_fullscreen_visibility.cc',
+ 'win/scoped_fullscreen_visibility.h',
+ ],
+ }],
['OS!="win"', {
'sources!': [
'win/fullscreen_handler.cc',
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index fbb62fa..190e10c 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -249,12 +249,7 @@ bool NativeWidgetWin::HasCapture() const {
}
InputMethod* NativeWidgetWin::CreateInputMethod() {
-#if !defined(USE_AURA)
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (!command_line->HasSwitch(switches::kEnableViewsTextfield))
- return NULL;
-#endif
- return new InputMethodWin(GetMessageHandler());
+ return message_handler_->CreateInputMethod();
}
internal::InputMethodDelegate* NativeWidgetWin::GetInputMethodDelegate() {
@@ -475,7 +470,7 @@ void NativeWidgetWin::FocusNativeView(gfx::NativeView native_view) {
}
gfx::Rect NativeWidgetWin::GetWorkAreaBoundsInScreen() const {
- return gfx::Screen::GetDisplayNearestWindow(GetNativeView()).work_area();
+ return message_handler_->GetWorkAreaBoundsInScreen();
}
void NativeWidgetWin::SetInactiveRenderingDisabled(bool value) {
@@ -751,16 +746,10 @@ void NativeWidgetWin::HandleFrameChanged() {
void NativeWidgetWin::HandleNativeFocus(HWND last_focused_window) {
delegate_->OnNativeFocus(last_focused_window);
- InputMethod* input_method = GetInputMethod();
- if (input_method)
- input_method->OnFocus();
}
void NativeWidgetWin::HandleNativeBlur(HWND focused_window) {
delegate_->OnNativeBlur(focused_window);
- InputMethod* input_method = GetInputMethod();
- if (input_method)
- input_method->OnBlur();
}
bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) {
@@ -771,38 +760,6 @@ bool NativeWidgetWin::HandleKeyEvent(const ui::KeyEvent& event) {
return delegate_->OnKeyEvent(event);
}
-bool NativeWidgetWin::HandleUntranslatedKeyEvent(const ui::KeyEvent& event) {
- InputMethod* input_method = GetInputMethod();
- if (input_method)
- input_method->DispatchKeyEvent(event);
- return !!input_method;
-}
-
-bool NativeWidgetWin::HandleIMEMessage(UINT message,
- WPARAM w_param,
- LPARAM l_param,
- LRESULT* result) {
- InputMethod* input_method = GetInputMethod();
- if (!input_method || input_method->IsMock()) {
- *result = 0;
- return false;
- }
-
- InputMethodWin* ime_win = static_cast<InputMethodWin*>(input_method);
- BOOL handled = FALSE;
- *result = ime_win->OnImeMessages(message, w_param, l_param, &handled);
- return !!handled;
-}
-
-void NativeWidgetWin::HandleInputLanguageChange(DWORD character_set,
- HKL input_language_id) {
- InputMethod* input_method = GetInputMethod();
- if (input_method && !input_method->IsMock()) {
- static_cast<InputMethodWin*>(input_method)->OnInputLangChange(
- character_set, input_language_id);
- }
-}
-
bool NativeWidgetWin::HandlePaintAccelerated(const gfx::Rect& invalid_rect) {
return delegate_->OnNativeWidgetPaintAccelerated(gfx::Rect(invalid_rect));
}
diff --git a/ui/views/widget/native_widget_win.h b/ui/views/widget/native_widget_win.h
index bb65868..a8baf32 100644
--- a/ui/views/widget/native_widget_win.h
+++ b/ui/views/widget/native_widget_win.h
@@ -229,13 +229,6 @@ class VIEWS_EXPORT NativeWidgetWin : public internal::NativeWidgetPrivate,
virtual void HandleNativeBlur(HWND focused_window) OVERRIDE;
virtual bool HandleMouseEvent(const ui::MouseEvent& event) OVERRIDE;
virtual bool HandleKeyEvent(const ui::KeyEvent& event) OVERRIDE;
- virtual bool HandleUntranslatedKeyEvent(const ui::KeyEvent& event) OVERRIDE;
- virtual bool HandleIMEMessage(UINT message,
- WPARAM w_param,
- LPARAM l_param,
- LRESULT* result) OVERRIDE;
- virtual void HandleInputLanguageChange(DWORD character_set,
- HKL input_language_id) OVERRIDE;
virtual bool HandlePaintAccelerated(const gfx::Rect& invalid_rect) OVERRIDE;
virtual void HandlePaint(gfx::Canvas* canvas) OVERRIDE;
virtual void HandleScreenReaderDetected() OVERRIDE;
diff --git a/ui/views/win/DEPS b/ui/views/win/DEPS
index 01bf1a1..b3efd79 100644
--- a/ui/views/win/DEPS
+++ b/ui/views/win/DEPS
@@ -8,6 +8,7 @@ include_rules = [
"+ui/gfx",
"+ui/views/accessibility/native_view_accessibility_win.h",
"+ui/views/ime/input_method_delegate.h",
+ "+ui/views/ime/input_method_win.h",
"+ui/views/views_delegate.h",
"+ui/views/views_export.h",
"+ui/views/widget/child_window_message_processor.h",
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index e0b24d41..86bc878 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -23,7 +23,10 @@
#include "ui/gfx/insets.h"
#include "ui/gfx/path.h"
#include "ui/gfx/screen.h"
+#include "ui/views/accessibility/native_view_accessibility_win.h"
+#include "ui/views/ime/input_method_win.h"
#include "ui/views/views_delegate.h"
+#include "ui/views/widget/child_window_message_processor.h"
#include "ui/views/widget/monitor_win.h"
#include "ui/views/widget/native_widget_win.h"
#include "ui/views/widget/widget_hwnd_utils.h"
@@ -32,8 +35,8 @@
#include "ui/views/win/scoped_fullscreen_visibility.h"
#if !defined(USE_AURA)
-#include "ui/views/accessibility/native_view_accessibility_win.h"
-#include "ui/views/widget/child_window_message_processor.h"
+#include "base/command_line.h"
+#include "ui/base/ui_base_switches.h"
#endif
namespace views {
@@ -186,15 +189,12 @@ struct FindOwnedWindowsData {
};
BOOL CALLBACK FindOwnedWindowsCallback(HWND hwnd, LPARAM param) {
- // TODO(beng): resolve wrt aura.
-#if !defined(USE_AURA)
FindOwnedWindowsData* data = reinterpret_cast<FindOwnedWindowsData*>(param);
if (GetWindow(hwnd, GW_OWNER) == data->window) {
Widget* widget = Widget::GetWidgetForNativeView(hwnd);
if (widget)
data->owned_widgets.push_back(widget);
}
-#endif
return TRUE;
}
@@ -239,8 +239,6 @@ static BOOL CALLBACK ClipDCToChild(HWND window, LPARAM param) {
return TRUE;
}
-#if !defined(USE_AURA)
-
// Get the source HWND of the specified message. Depending on the message, the
// source HWND is encoded in either the WPARAM or the LPARAM value.
HWND GetControlHWNDForMessage(UINT message, WPARAM w_param, LPARAM l_param) {
@@ -285,8 +283,6 @@ bool ProcessChildWindowMessage(UINT message,
return false;
}
-#endif
-
// A custom MSAA object id used to determine if a screen reader is actively
// listening for MSAA events.
const int kCustomObjectID = 1;
@@ -511,6 +507,10 @@ void HWNDMessageHandler::GetWindowPlacement(
}
}
+gfx::Rect HWNDMessageHandler::GetWorkAreaBoundsInScreen() const {
+ return gfx::Screen::GetDisplayNearestWindow(hwnd()).work_area();
+}
+
void HWNDMessageHandler::SetBounds(const gfx::Rect& bounds) {
LONG style = GetWindowLong(hwnd(), GWL_STYLE);
if (style & WS_MAXIMIZE)
@@ -734,26 +734,30 @@ void HWNDMessageHandler::SetVisibilityChangedAnimationsEnabled(bool enabled) {
}
}
+InputMethod* HWNDMessageHandler::CreateInputMethod() {
+#if !defined(USE_AURA)
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (!command_line->HasSwitch(switches::kEnableViewsTextfield))
+ return NULL;
+#endif
+ return new InputMethodWin(this);
+}
+
void HWNDMessageHandler::SetTitle(const string16& title) {
SetWindowText(hwnd(), title.c_str());
SetAccessibleName(title);
}
void HWNDMessageHandler::SetAccessibleName(const string16& name) {
- // TODO(beng): figure out vis-a-vis aura.
-#if !defined(USE_AURA)
base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
if (SUCCEEDED(hr))
hr = pAccPropServices->SetHwndPropStr(hwnd(), OBJID_CLIENT, CHILDID_SELF,
PROPID_ACC_NAME, name.c_str());
-#endif
}
void HWNDMessageHandler::SetAccessibleRole(ui::AccessibilityTypes::Role role) {
- // TODO(beng): figure out vis-a-vis aura.
-#if !defined(USE_AURA)
base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
@@ -766,13 +770,10 @@ void HWNDMessageHandler::SetAccessibleRole(ui::AccessibilityTypes::Role role) {
PROPID_ACC_ROLE, var);
}
}
-#endif
}
void HWNDMessageHandler::SetAccessibleState(
ui::AccessibilityTypes::State state) {
- // TODO(beng): figure out vis-a-vis aura.
-#if !defined(USE_AURA)
base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
@@ -785,14 +786,11 @@ void HWNDMessageHandler::SetAccessibleState(
PROPID_ACC_STATE, var);
}
}
-#endif
}
void HWNDMessageHandler::SendNativeAccessibilityEvent(
int id,
ui::AccessibilityTypes::Event event_type) {
- // TODO(beng): figure out vis-a-vis aura.
-#if !defined(USE_AURA)
// Now call the Windows-specific method to notify MSAA clients of this
// event. The widget gives us a temporary unique child ID to associate
// with this view so that clients can call get_accChild in
@@ -800,7 +798,6 @@ void HWNDMessageHandler::SendNativeAccessibilityEvent(
// with this view.
::NotifyWinEvent(NativeViewAccessibilityWin::MSAAEvent(event_type), hwnd(),
OBJID_CLIENT, id);
-#endif
}
void HWNDMessageHandler::SetCursor(HCURSOR cursor) {
@@ -912,13 +909,11 @@ LRESULT HWNDMessageHandler::OnWndProc(UINT message,
if (delegate_->PreHandleMSG(message, w_param, l_param, &result))
return result;
-#if !defined(USE_AURA)
// First allow messages sent by child controls to be processed directly by
// their associated views. If such a view is present, it will handle the
// message *instead of* this NativeWidgetWin.
if (ProcessChildWindowMessage(message, w_param, l_param, &result))
return result;
-#endif
// Otherwise we handle everything else.
if (!ProcessWindowMessage(window, message, w_param, l_param, result))
@@ -1119,10 +1114,7 @@ void HWNDMessageHandler::ResetWindowRegion(bool force) {
gfx::Path window_mask;
delegate_->GetWindowMask(
gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask);
- // TODO(beng): resolve wrt aura.
-#if !defined(USE_AURA)
new_region = window_mask.CreateNativeRegion();
-#endif
}
if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) {
@@ -1404,9 +1396,16 @@ LRESULT HWNDMessageHandler::OnGetObject(UINT message,
LRESULT HWNDMessageHandler::OnImeMessages(UINT message,
WPARAM w_param,
LPARAM l_param) {
- LRESULT result = 0;
- SetMsgHandled(delegate_->HandleIMEMessage(
- message, w_param, l_param, &result));
+ InputMethod* input_method = delegate_->GetInputMethod();
+ if (!input_method || input_method->IsMock()) {
+ SetMsgHandled(FALSE);
+ return 0;
+ }
+
+ InputMethodWin* ime_win = static_cast<InputMethodWin*>(input_method);
+ BOOL handled = FALSE;
+ LRESULT result = ime_win->OnImeMessages(message, w_param, l_param, &handled);
+ SetMsgHandled(handled);
return result;
}
@@ -1428,22 +1427,32 @@ void HWNDMessageHandler::OnInitMenu(HMENU menu) {
void HWNDMessageHandler::OnInputLangChange(DWORD character_set,
HKL input_language_id) {
- delegate_->HandleInputLanguageChange(character_set, input_language_id);
+ InputMethod* input_method = delegate_->GetInputMethod();
+ if (input_method && !input_method->IsMock()) {
+ static_cast<InputMethodWin*>(input_method)->OnInputLangChange(
+ character_set, input_language_id);
+ }
}
LRESULT HWNDMessageHandler::OnKeyEvent(UINT message,
WPARAM w_param,
LPARAM l_param) {
-
MSG msg = { hwnd(), message, w_param, l_param };
ui::KeyEvent key(msg, message == WM_CHAR);
- if (!delegate_->HandleUntranslatedKeyEvent(key))
+ InputMethod* input_method = delegate_->GetInputMethod();
+ if (input_method)
+ input_method->DispatchKeyEvent(key);
+ else
DispatchKeyEventPostIME(key);
return 0;
}
void HWNDMessageHandler::OnKillFocus(HWND focused_window) {
delegate_->HandleNativeBlur(focused_window);
+
+ InputMethod* input_method = delegate_->GetInputMethod();
+ if (input_method)
+ input_method->OnBlur();
SetMsgHandled(FALSE);
}
@@ -1830,12 +1839,9 @@ void HWNDMessageHandler::OnPaint(HDC dc) {
if (delegate_->HandlePaintAccelerated(gfx::Rect(dirty_rect))) {
ValidateRect(hwnd(), NULL);
} else {
- // TODO(beng): resolve vis-a-vis aura
-#if !defined(USE_AURA)
scoped_ptr<gfx::CanvasPaint> canvas(
gfx::CanvasPaint::CreateCanvasPaint(hwnd()));
delegate_->HandlePaint(canvas->AsCanvas());
-#endif
}
} else {
// TODO(msw): Find a better solution for this crbug.com/93530 workaround.
@@ -1872,6 +1878,9 @@ LRESULT HWNDMessageHandler::OnSetCursor(UINT message,
void HWNDMessageHandler::OnSetFocus(HWND last_focused_window) {
delegate_->HandleNativeFocus(last_focused_window);
+ InputMethod* input_method = delegate_->GetInputMethod();
+ if (input_method)
+ input_method->OnFocus();
SetMsgHandled(FALSE);
}
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
index 7f73b2b..940bbf0 100644
--- a/ui/views/win/hwnd_message_handler.h
+++ b/ui/views/win/hwnd_message_handler.h
@@ -75,6 +75,7 @@ class VIEWS_EXPORT HWNDMessageHandler : public ui::WindowImpl,
gfx::Rect GetRestoredBounds() const;
void GetWindowPlacement(gfx::Rect* bounds,
ui::WindowShowState* show_state) const;
+ gfx::Rect GetWorkAreaBoundsInScreen() const;
void SetBounds(const gfx::Rect& bounds);
void SetSize(const gfx::Size& size);
@@ -125,6 +126,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public ui::WindowImpl,
void SetVisibilityChangedAnimationsEnabled(bool enabled);
+ InputMethod* CreateInputMethod();
+
void SetTitle(const string16& title);
void SetAccessibleName(const string16& name);
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h
index 6d3826e..9dddce5 100644
--- a/ui/views/win/hwnd_message_handler_delegate.h
+++ b/ui/views/win/hwnd_message_handler_delegate.h
@@ -156,26 +156,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
// handled by the delegate.
virtual bool HandleMouseEvent(const ui::MouseEvent& event) = 0;
- // Called when a translated key event is received (i.e. post IME translation.)
- // Returns true if the event was handled by the delegate.
+ // Called when a key event is received. Returns true if the event was handled
+ // by the delegate.
virtual bool HandleKeyEvent(const ui::KeyEvent& event) = 0;
- // Called when an untranslated key event is received (i.e. pre-IME
- // translation). Returns true if the event was sent to the input method.
- virtual bool HandleUntranslatedKeyEvent(const ui::KeyEvent& event) = 0;
-
- // Called when an IME message needs to be processed by the delegate. Returns
- // true if the event was handled and no default processing should be
- // performed.
- virtual bool HandleIMEMessage(UINT message,
- WPARAM w_param,
- LPARAM l_param,
- LRESULT* result) = 0;
-
- // Called when the system input language changes.
- virtual void HandleInputLanguageChange(DWORD character_set,
- HKL input_language_id) = 0;
-
// Called to compel the delegate to paint |invalid_rect| accelerated. Returns
// true if accelerated painting was performed.
virtual bool HandlePaintAccelerated(const gfx::Rect& invalid_rect) = 0;