summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authoryukawa@chromium.org <yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 13:48:54 +0000
committeryukawa@chromium.org <yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 13:48:54 +0000
commitfcb0c8c9a696d4b697a4a2c3fed1a79178039f9f (patch)
tree09013f0c403b2a3d048032c86afafa8785ebb6c5 /base
parentf068ad0e15169ffdced12bd4a46904b440f6413a (diff)
downloadchromium_src-fcb0c8c9a696d4b697a4a2c3fed1a79178039f9f.zip
chromium_src-fcb0c8c9a696d4b697a4a2c3fed1a79178039f9f.tar.gz
chromium_src-fcb0c8c9a696d4b697a4a2c3fed1a79178039f9f.tar.bz2
Revert r151669 and r155589 as non-Aura Metro mode is gone
Now TSF-related code is completely consolidated into the metro_driver process. We can safely revert the following CLs: - r155589 : Call TSF-based UI message pump APIs by introducing an injection mechanism into MessageLoopForUI. - r151669 : Introduce base::win::IsTSFAwareRequired() which indicates if TSF-awareness is required or not. BUG=319122, 330735 TEST=manually done on Windows 8.1 Review URL: https://codereview.chromium.org/141773009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gypi2
-rw-r--r--base/message_loop/message_loop.h11
-rw-r--r--base/message_loop/message_pump_win.cc31
-rw-r--r--base/message_loop/message_pump_win.h35
-rw-r--r--base/win/metro.cc6
-rw-r--r--base/win/metro.h4
-rw-r--r--base/win/text_services_message_filter.cc82
-rw-r--r--base/win/text_services_message_filter.h48
8 files changed, 11 insertions, 208 deletions
diff --git a/base/base.gypi b/base/base.gypi
index 8ed1fe3..98033af 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -704,8 +704,6 @@
'win/shortcut.h',
'win/startup_information.cc',
'win/startup_information.h',
- 'win/text_services_message_filter.cc',
- 'win/text_services_message_filter.h',
'win/win_util.cc',
'win/win_util.h',
'win/windows_version.cc',
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 2388b59..956f5f0 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -550,10 +550,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
//
class BASE_EXPORT MessageLoopForUI : public MessageLoop {
public:
-#if defined(OS_WIN)
- typedef MessagePumpForUI::MessageFilter MessageFilter;
-#endif
-
MessageLoopForUI() : MessageLoop(TYPE_UI) {
}
@@ -592,13 +588,6 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop {
void RemoveObserver(Observer* observer);
#endif
-#if defined(OS_WIN)
- // Plese see MessagePumpForUI for definitions of this method.
- void SetMessageFilter(scoped_ptr<MessageFilter> message_filter) {
- pump_ui()->SetMessageFilter(message_filter.Pass());
- }
-#endif
-
protected:
#if defined(USE_X11)
friend class MessagePumpX11;
diff --git a/base/message_loop/message_pump_win.cc b/base/message_loop/message_pump_win.cc
index cd16054..ae022bf 100644
--- a/base/message_loop/message_pump_win.cc
+++ b/base/message_loop/message_pump_win.cc
@@ -97,8 +97,7 @@ int MessagePumpWin::GetCurrentDelay() const {
// MessagePumpForUI public:
MessagePumpForUI::MessagePumpForUI()
- : atom_(0),
- message_filter_(new MessageFilter) {
+ : atom_(0) {
InitMessageWnd();
}
@@ -346,7 +345,7 @@ bool MessagePumpForUI::ProcessNextWindowsMessage() {
sent_messages_in_queue = true;
MSG msg;
- if (message_filter_->DoPeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) != FALSE)
return ProcessMessageHelper(msg);
return sent_messages_in_queue;
@@ -372,16 +371,14 @@ bool MessagePumpForUI::ProcessMessageHelper(const MSG& msg) {
WillProcessMessage(msg);
- if (!message_filter_->ProcessMessage(msg)) {
- uint32_t action = MessagePumpDispatcher::POST_DISPATCH_PERFORM_DEFAULT;
- if (state_->dispatcher)
- action = state_->dispatcher->Dispatch(msg);
- if (action & MessagePumpDispatcher::POST_DISPATCH_QUIT_LOOP)
- state_->should_quit = true;
- if (action & MessagePumpDispatcher::POST_DISPATCH_PERFORM_DEFAULT) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
+ uint32_t action = MessagePumpDispatcher::POST_DISPATCH_PERFORM_DEFAULT;
+ if (state_->dispatcher)
+ action = state_->dispatcher->Dispatch(msg);
+ if (action & MessagePumpDispatcher::POST_DISPATCH_QUIT_LOOP)
+ state_->should_quit = true;
+ if (action & MessagePumpDispatcher::POST_DISPATCH_PERFORM_DEFAULT) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
}
DidProcessMessage(msg);
@@ -408,8 +405,7 @@ bool MessagePumpForUI::ProcessPumpReplacementMessage() {
have_message = PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE) ||
PeekMessage(&msg, NULL, WM_TIMER, WM_TIMER, PM_REMOVE);
} else {
- have_message = !!message_filter_->DoPeekMessage(&msg, NULL, 0, 0,
- PM_REMOVE);
+ have_message = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) != FALSE;
}
DCHECK(!have_message || kMsgHaveWork != msg.message ||
@@ -431,11 +427,6 @@ bool MessagePumpForUI::ProcessPumpReplacementMessage() {
return ProcessMessageHelper(msg);
}
-void MessagePumpForUI::SetMessageFilter(
- scoped_ptr<MessageFilter> message_filter) {
- message_filter_ = message_filter.Pass();
-}
-
//-----------------------------------------------------------------------------
// MessagePumpForIO public:
diff --git a/base/message_loop/message_pump_win.h b/base/message_loop/message_pump_win.h
index 9184058..535a213 100644
--- a/base/message_loop/message_pump_win.h
+++ b/base/message_loop/message_pump_win.h
@@ -11,7 +11,6 @@
#include "base/base_export.h"
#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_dispatcher.h"
#include "base/message_loop/message_pump_observer.h"
@@ -127,44 +126,12 @@ class BASE_EXPORT MessagePumpWin : public MessagePump {
//
class BASE_EXPORT MessagePumpForUI : public MessagePumpWin {
public:
- // A MessageFilter implements the common Peek/Translate/Dispatch code to deal
- // with windows messages.
- // This abstraction is used to inject TSF message peeking. See
- // TextServicesMessageFilter.
- class BASE_EXPORT MessageFilter {
- public:
- virtual ~MessageFilter() {}
- // Implements the functionality exposed by the OS through PeekMessage.
- virtual BOOL DoPeekMessage(MSG* msg,
- HWND window_handle,
- UINT msg_filter_min,
- UINT msg_filter_max,
- UINT remove_msg) {
- return PeekMessage(msg, window_handle, msg_filter_min, msg_filter_max,
- remove_msg);
- }
- // Returns true if |message| was consumed by the filter and no extra
- // processing is required. If this method returns false, it is the
- // responsibility of the caller to ensure that normal processing takes
- // place.
- // The priority to consume messages is the following:
- // - Native Windows' message filter (CallMsgFilter).
- // - MessageFilter::ProcessMessage.
- // - MessagePumpDispatcher.
- // - TranslateMessage / DispatchMessage.
- virtual bool ProcessMessage(const MSG& msg) { return false;}
- };
// The application-defined code passed to the hook procedure.
static const int kMessageFilterCode = 0x5001;
MessagePumpForUI();
virtual ~MessagePumpForUI();
- // Sets a new MessageFilter. MessagePumpForUI takes ownership of
- // |message_filter|. When SetMessageFilter is called, old MessageFilter is
- // deleted.
- void SetMessageFilter(scoped_ptr<MessageFilter> message_filter);
-
// MessagePump methods:
virtual void ScheduleWork();
virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
@@ -188,8 +155,6 @@ class BASE_EXPORT MessagePumpForUI : public MessagePumpWin {
// A hidden message-only window.
HWND message_hwnd_;
-
- scoped_ptr<MessageFilter> message_filter_;
};
//-----------------------------------------------------------------------------
diff --git a/base/win/metro.cc b/base/win/metro.cc
index 1911f90..62743c7 100644
--- a/base/win/metro.cc
+++ b/base/win/metro.cc
@@ -66,12 +66,6 @@ bool IsProcessImmersive(HANDLE process) {
return false;
}
-bool IsTSFAwareRequired() {
- // Although this function is equal to IsMetroProcess at this moment,
- // Chrome for Win7 and Vista may support TSF in the future.
- return IsMetroProcess();
-}
-
wchar_t* LocalAllocAndCopyString(const string16& src) {
size_t dest_size = (src.length() + 1) * sizeof(wchar_t);
wchar_t* dest = reinterpret_cast<wchar_t*>(LocalAlloc(LPTR, dest_size));
diff --git a/base/win/metro.h b/base/win/metro.h
index 04bab1e..5894ef0 100644
--- a/base/win/metro.h
+++ b/base/win/metro.h
@@ -76,10 +76,6 @@ BASE_EXPORT bool IsMetroProcess();
// immersive (Metro) process.
BASE_EXPORT bool IsProcessImmersive(HANDLE process);
-// Returns true if this process is running under Text Services Framework (TSF)
-// and browser must be TSF-aware.
-BASE_EXPORT bool IsTSFAwareRequired();
-
// Allocates and returns the destination string via the LocalAlloc API after
// copying the src to it.
BASE_EXPORT wchar_t* LocalAllocAndCopyString(const string16& src);
diff --git a/base/win/text_services_message_filter.cc b/base/win/text_services_message_filter.cc
deleted file mode 100644
index 7ce233d9..0000000
--- a/base/win/text_services_message_filter.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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.
-
-#include "base/win/text_services_message_filter.h"
-
-namespace base {
-namespace win {
-
-TextServicesMessageFilter::TextServicesMessageFilter()
- : client_id_(TF_CLIENTID_NULL),
- is_initialized_(false) {
-}
-
-TextServicesMessageFilter::~TextServicesMessageFilter() {
- if (is_initialized_)
- thread_mgr_->Deactivate();
-}
-
-bool TextServicesMessageFilter::Init() {
- if (FAILED(thread_mgr_.CreateInstance(CLSID_TF_ThreadMgr)))
- return false;
-
- if (FAILED(message_pump_.QueryFrom(thread_mgr_)))
- return false;
-
- if (FAILED(keystroke_mgr_.QueryFrom(thread_mgr_)))
- return false;
-
- if (FAILED(thread_mgr_->Activate(&client_id_)))
- return false;
-
- is_initialized_ = true;
- return is_initialized_;
-}
-
-// Wraps for ITfMessagePump::PeekMessage with win32 PeekMessage signature.
-// Obtains messages from application message queue.
-BOOL TextServicesMessageFilter::DoPeekMessage(MSG* msg,
- HWND window_handle,
- UINT msg_filter_min,
- UINT msg_filter_max,
- UINT remove_msg) {
- BOOL result = FALSE;
- if (FAILED(message_pump_->PeekMessage(msg, window_handle,
- msg_filter_min, msg_filter_max,
- remove_msg, &result))) {
- result = FALSE;
- }
-
- return result;
-}
-
-// Sends message to Text Service Manager.
-// The message will be used to input composition text.
-// Returns true if |message| was consumed by text service manager.
-bool TextServicesMessageFilter::ProcessMessage(const MSG& msg) {
- if (msg.message == WM_KEYDOWN) {
- BOOL eaten = FALSE;
- HRESULT hr = keystroke_mgr_->TestKeyDown(msg.wParam, msg.lParam, &eaten);
- if (FAILED(hr) && !eaten)
- return false;
- eaten = FALSE;
- hr = keystroke_mgr_->KeyDown(msg.wParam, msg.lParam, &eaten);
- return (SUCCEEDED(hr) && !!eaten);
- }
-
- if (msg.message == WM_KEYUP) {
- BOOL eaten = FALSE;
- HRESULT hr = keystroke_mgr_->TestKeyUp(msg.wParam, msg.lParam, &eaten);
- if (FAILED(hr) && !eaten)
- return false;
- eaten = FALSE;
- hr = keystroke_mgr_->KeyUp(msg.wParam, msg.lParam, &eaten);
- return (SUCCEEDED(hr) && !!eaten);
- }
-
- return false;
-}
-
-} // namespace win
-} // namespace base
diff --git a/base/win/text_services_message_filter.h b/base/win/text_services_message_filter.h
deleted file mode 100644
index 704c1da..0000000
--- a/base/win/text_services_message_filter.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.
-
-#ifndef BASE_WIN_TEXT_SERVICES_MESSAGE_FILTER_H_
-#define BASE_WIN_TEXT_SERVICES_MESSAGE_FILTER_H_
-
-#include <msctf.h>
-#include <Windows.h>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_pump_win.h"
-#include "base/win/metro.h"
-#include "base/win/scoped_comptr.h"
-
-namespace base {
-namespace win {
-
-// TextServicesMessageFilter extends MessageFilter with methods that are using
-// Text Services Framework COM component.
-class BASE_EXPORT TextServicesMessageFilter
- : public base::MessagePumpForUI::MessageFilter {
- public:
- TextServicesMessageFilter();
- virtual ~TextServicesMessageFilter();
- virtual BOOL DoPeekMessage(MSG* msg,
- HWND window_handle,
- UINT msg_filter_min,
- UINT msg_filter_max,
- UINT remove_msg) OVERRIDE;
- virtual bool ProcessMessage(const MSG& msg) OVERRIDE;
-
- bool Init();
-
- private:
- TfClientId client_id_;
- bool is_initialized_;
- base::win::ScopedComPtr<ITfThreadMgr> thread_mgr_;
- base::win::ScopedComPtr<ITfMessagePump> message_pump_;
- base::win::ScopedComPtr<ITfKeystrokeMgr> keystroke_mgr_;
-
- DISALLOW_COPY_AND_ASSIGN(TextServicesMessageFilter);
-};
-
-} // namespace win
-} // namespace base
-
-#endif // BASE_WIN_TEXT_SERVICES_MESSAGE_FILTER_H_