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

Unified Diff: cloud_print/service/win/cloud_print_service_config.cc

Issue 152033005: Use MessagePumpDispatcher instead of MessageFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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: cloud_print/service/win/cloud_print_service_config.cc
diff --git a/cloud_print/service/win/cloud_print_service_config.cc b/cloud_print/service/win/cloud_print_service_config.cc
index d622e64216291771668be2df1a29af45618c9d28..d19e25682a99038aa6588bb295d04ca5dade915a 100644
--- a/cloud_print/service/win/cloud_print_service_config.cc
+++ b/cloud_print/service/win/cloud_print_service_config.cc
@@ -11,6 +11,8 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/message_loop/message_loop.h"
+#include "base/message_loop/message_pump_dispatcher.h"
+#include "base/run_loop.h"
#include "base/strings/string16.h"
#include "base/threading/thread.h"
#include "chrome/common/chrome_constants.h"
@@ -29,15 +31,19 @@ class SetupDialog : public base::RefCounted<SetupDialog>,
public ATL::CDialogImpl<SetupDialog> {
public:
// Enables accelerators.
- class MessageFilter : public base::MessageLoopForUI::MessageFilter {
+ class Dispatcher : public base::MessagePumpDispatcher {
public:
- explicit MessageFilter(SetupDialog* dialog) : dialog_(dialog){}
- virtual ~MessageFilter() {};
+ explicit Dispatcher(SetupDialog* dialog) : dialog_(dialog) {}
+ virtual ~Dispatcher() {};
- // MessageLoopForUI::MessageFilter
- virtual bool ProcessMessage(const MSG& msg) OVERRIDE {
+ // MessagePumpDispatcher:
+ virtual bool Dispatch(const MSG& msg) OVERRIDE {
MSG msg2 = msg;
- return dialog_->IsDialogMessage(&msg2) != FALSE;
+ if (!dialog_->IsDialogMessage(&msg2)) {
+ ::TranslateMessage(&msg);
+ ::DispatchMessage(&msg);
+ }
+ return true;
}
private:
@@ -444,10 +450,9 @@ int WINAPI WinMain(__in HINSTANCE hInstance,
scoped_refptr<SetupDialog> dialog(new SetupDialog());
dialog->Create(NULL);
dialog->ShowWindow(SW_SHOW);
- scoped_ptr<SetupDialog::MessageFilter> filter(
- new SetupDialog::MessageFilter(dialog));
- loop.SetMessageFilter(filter.Pass());
-
- loop.Run();
+ SetupDialog::Dispatcher dispatcher(dialog);
+ base::RunLoop run_loop;
+ run_loop.set_dispatcher(&dispatcher);
+ run_loop.Run();
return 0;
}
« 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