Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / ui / views / win / hwnd_message_handler.h
index bfa1710..f19dfef 100644 (file)
@@ -78,10 +78,12 @@ const int WM_NCUAHDRAWFRAME = 0xAF;
                             LPARAM l_param, \
                             LRESULT& l_result, \
                             DWORD msg_map_id = 0) { \
+    base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
     BOOL old_msg_handled = msg_handled_; \
     BOOL ret = _ProcessWindowMessage(hwnd, msg, w_param, l_param, l_result, \
                                      msg_map_id); \
-    msg_handled_ = old_msg_handled; \
+    if (ref.get()) \
+      msg_handled_ = old_msg_handled; \
     return ret; \
   } \
   BOOL _ProcessWindowMessage(HWND hWnd, \
@@ -130,7 +132,10 @@ class VIEWS_EXPORT HWNDMessageHandler :
   void GetWindowPlacement(gfx::Rect* bounds,
                           ui::WindowShowState* show_state) const;
 
-  void SetBounds(const gfx::Rect& bounds_in_pixels);
+  // Sets the bounds of the HWND to |bounds_in_pixels|. If the HWND size is not
+  // changed, |force_size_changed| determines if we should pretend it is.
+  void SetBounds(const gfx::Rect& bounds_in_pixels, bool force_size_changed);
+
   void SetSize(const gfx::Size& size);
   void CenterWindow(const gfx::Size& size);
 
@@ -198,6 +203,11 @@ class VIEWS_EXPORT HWNDMessageHandler :
     use_system_default_icon_ = use_system_default_icon;
   }
 
+  void SetFullscreen(bool fullscreen);
+
+  // Updates the window style to reflect whether it can be resized or maximized.
+  void SizeConstraintsChanged();
+
  private:
   typedef std::set<DWORD> TouchIDs;
 
@@ -213,21 +223,26 @@ class VIEWS_EXPORT HWNDMessageHandler :
   // Overridden from WindowEventTarget
   virtual LRESULT HandleMouseMessage(unsigned int message,
                                      WPARAM w_param,
-                                     LPARAM l_param) OVERRIDE;
+                                     LPARAM l_param,
+                                     bool* handled) OVERRIDE;
   virtual LRESULT HandleKeyboardMessage(unsigned int message,
                                         WPARAM w_param,
-                                        LPARAM l_param) OVERRIDE;
+                                        LPARAM l_param,
+                                        bool* handled) OVERRIDE;
   virtual LRESULT HandleTouchMessage(unsigned int message,
                                      WPARAM w_param,
-                                     LPARAM l_param) OVERRIDE;
+                                     LPARAM l_param,
+                                     bool* handled) OVERRIDE;
 
   virtual LRESULT HandleScrollMessage(unsigned int message,
                                       WPARAM w_param,
-                                      LPARAM l_param) OVERRIDE;
+                                      LPARAM l_param,
+                                      bool* handled) OVERRIDE;
 
   virtual LRESULT HandleNcHitTestMessage(unsigned int message,
                                          WPARAM w_param,
-                                         LPARAM l_param) OVERRIDE;
+                                         LPARAM l_param,
+                                         bool* handled) OVERRIDE;
 
   // Returns the auto-hide edges of the appbar. See
   // ViewsDelegate::GetAppbarAutohideEdges() for details. If the edges change,
@@ -473,6 +488,9 @@ class VIEWS_EXPORT HWNDMessageHandler :
                                  int message_time,
                                  LPARAM l_param);
 
+  // Provides functionality to transition a frame to DWM.
+  void PerformDwmTransition();
+
   HWNDMessageHandlerDelegate* delegate_;
 
   scoped_ptr<FullscreenHandler> fullscreen_handler_;
@@ -585,12 +603,12 @@ class VIEWS_EXPORT HWNDMessageHandler :
   // class. Allows callers to retrieve the interface pointer.
   scoped_ptr<ui::ViewProp> prop_window_target_;
 
-  // Set to true if we are in the context of a touch down event. This is reset
-  // to false in a delayed task. Defaults to false.
+  // Number of active touch down contexts. This is incremented on touch down
+  // events and decremented later using a delayed task.
   // We need this to ignore WM_MOUSEACTIVATE messages generated in response to
   // touch input. This is fine because activation still works correctly via
   // native SetFocus calls invoked in the views code.
-  bool touch_down_context_;
+  int touch_down_contexts_;
 
   // Time the last touch message was received. Used to flag mouse messages
   // synthesized by Windows for touch which are not flagged by the OS as
@@ -602,6 +620,14 @@ class VIEWS_EXPORT HWNDMessageHandler :
   // HandleMouseEventInternal function as to why this is needed.
   long last_mouse_hwheel_time_;
 
+  // On Windows Vista and beyond, if we are transitioning from custom frame
+  // to Aero(glass) we delay setting the DWM related properties in full
+  // screen mode as DWM is not supported in full screen windows. We perform
+  // the DWM related operations when the window comes out of fullscreen mode.
+  // This member variable is set to true if the window is transitioning to
+  // glass. Defaults to false.
+  bool dwm_transition_desired_;
+
   DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler);
 };