Index: content/browser/screen_orientation/screen_orientation_message_filter_android.cc |
diff --git a/content/browser/screen_orientation/screen_orientation_message_filter_android.cc b/content/browser/screen_orientation/screen_orientation_message_filter_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b4c975988fa02c92d05d868c19c05be60f4bee62 |
--- /dev/null |
+++ b/content/browser/screen_orientation/screen_orientation_message_filter_android.cc |
@@ -0,0 +1,50 @@ |
+// Copyright 2014 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 "content/browser/screen_orientation/screen_orientation_message_filter_android.h" |
+ |
+#include "content/browser/screen_orientation/screen_orientation_provider_android.h" |
+#include "content/common/screen_orientation_messages.h" |
+ |
+#include <android/log.h> |
+ |
+namespace content { |
+ |
+ScreenOrientationMessageFilterAndroid::ScreenOrientationMessageFilterAndroid() |
+ : BrowserMessageFilter(ScreenOrientationMsgStart) { |
+} |
+ |
+ScreenOrientationMessageFilterAndroid::~ScreenOrientationMessageFilterAndroid() |
+{ |
jam
2014/07/16 21:29:14
nit: on previous line per style guide
mlamouri (slow - plz ping)
2014/07/17 09:44:16
With { on the previous line, the line gets longer
|
+} |
+ |
+bool ScreenOrientationMessageFilterAndroid::OnMessageReceived( |
+ const IPC::Message& message) { |
+ bool handled = true; |
+ IPC_BEGIN_MESSAGE_MAP(ScreenOrientationMessageFilterAndroid, message) |
+ IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_StartListening, |
+ OnStartListening) |
+ IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_StopListening, |
+ OnStopListening) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP() |
+ return handled; |
+} |
+ |
+void ScreenOrientationMessageFilterAndroid::OnStartListening() { |
+ ++listeners_count_; |
+ __android_log_print(ANDROID_LOG_WARN, "MOUNIR", "OnStartListening"); |
jam
2014/07/16 21:29:14
here and below, use our standard LOG macros
mlamouri (slow - plz ping)
2014/07/17 09:44:16
Oups, that did not meant to be here... It was only
|
+ if (listeners_count_ == 1) |
+ ScreenOrientationProviderAndroid::ToggleAccurateMode(); |
+} |
+ |
+void ScreenOrientationMessageFilterAndroid::OnStopListening() { |
+ DCHECK(listeners_count_ > 0); |
+__android_log_print(ANDROID_LOG_WARN, "MOUNIR", "OnStopListening"); |
+ --listeners_count_; |
+ if (listeners_count_ == 0) |
+ ScreenOrientationProviderAndroid::ToggleAccurateMode(); |
+} |
+ |
+} // namespace content |