Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / views / widget / desktop_aura / desktop_window_tree_host_win.cc
index 3d701b6..45f1a86 100644 (file)
@@ -35,7 +35,6 @@
 #include "ui/views/widget/widget_hwnd_utils.h"
 #include "ui/views/win/fullscreen_handler.h"
 #include "ui/views/win/hwnd_message_handler.h"
-#include "ui/views/window/native_frame_view.h"
 #include "ui/wm/core/compound_event_filter.h"
 #include "ui/wm/core/input_method_event_filter.h"
 #include "ui/wm/core/window_animations.h"
@@ -366,7 +365,7 @@ void DesktopWindowTreeHostWin::SetVisibilityChangedAnimationsEnabled(
 }
 
 bool DesktopWindowTreeHostWin::ShouldUseNativeFrame() const {
-  return ui::win::IsAeroGlassEnabled();
+  return IsTranslucentWindowOpacitySupported();
 }
 
 bool DesktopWindowTreeHostWin::ShouldWindowContentsBeTransparent() const {
@@ -382,11 +381,6 @@ void DesktopWindowTreeHostWin::FrameTypeChanged() {
   SetWindowTransparency();
 }
 
-NonClientFrameView* DesktopWindowTreeHostWin::CreateNonClientFrameView() {
-  return GetWidget()->ShouldUseNativeFrame() ?
-      new NativeFrameView(GetWidget()) : NULL;
-}
-
 void DesktopWindowTreeHostWin::SetFullscreen(bool fullscreen) {
   message_handler_->fullscreen_handler()->SetFullscreen(fullscreen);
   // TODO(sky): workaround for ScopedFullscreenVisibility showing window
@@ -419,7 +413,7 @@ void DesktopWindowTreeHostWin::FlashFrame(bool flash_frame) {
   message_handler_->FlashFrame(flash_frame);
 }
 
-void DesktopWindowTreeHostWin::OnRootViewLayout() const {
+void DesktopWindowTreeHostWin::OnRootViewLayout() {
 }
 
 void DesktopWindowTreeHostWin::OnNativeWidgetFocus() {
@@ -433,6 +427,10 @@ bool DesktopWindowTreeHostWin::IsAnimatingClosed() const {
   return pending_close_;
 }
 
+bool DesktopWindowTreeHostWin::IsTranslucentWindowOpacitySupported() const {
+  return ui::win::IsAeroGlassEnabled();
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // DesktopWindowTreeHostWin, WindowTreeHost implementation:
 
@@ -492,12 +490,7 @@ void DesktopWindowTreeHostWin::SetBounds(const gfx::Rect& bounds) {
   window_enlargement_ =
       gfx::Vector2d(new_expanded.width() - expanded.width(),
                     new_expanded.height() - expanded.height());
-  message_handler_->SetBounds(new_expanded);
-
-  // The client area size may have changed even though the window bounds have
-  // not, if the window bounds were expanded to 64 pixels both times.
-  if (old_hwnd_size == new_expanded.size() && old_content_size != bounds.size())
-    HandleClientSizeChanged(new_expanded.size());
+  message_handler_->SetBounds(new_expanded, old_content_size != bounds.size());
 }
 
 gfx::Point DesktopWindowTreeHostWin::GetLocationOnNativeScreen() const {
@@ -516,10 +509,6 @@ void DesktopWindowTreeHostWin::PostNativeEvent(
     const base::NativeEvent& native_event) {
 }
 
-void DesktopWindowTreeHostWin::OnDeviceScaleFactorChanged(
-    float device_scale_factor) {
-}
-
 void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) {
   ui::CursorLoaderWin cursor_loader;
   cursor_loader.SetPlatformCursor(&cursor);
@@ -611,7 +600,7 @@ bool DesktopWindowTreeHostWin::IsModal() const {
 }
 
 int DesktopWindowTreeHostWin::GetInitialShowState() const {
-  return SW_SHOWNORMAL;
+  return CanActivate() ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE;
 }
 
 bool DesktopWindowTreeHostWin::WillProcessWorkAreaChange() const {
@@ -656,7 +645,7 @@ void DesktopWindowTreeHostWin::ResetWindowControls() {
 }
 
 void DesktopWindowTreeHostWin::PaintLayeredWindow(gfx::Canvas* canvas) {
-  GetWidget()->GetRootView()->Paint(canvas);
+  GetWidget()->GetRootView()->Paint(canvas, views::CullSet());
 }
 
 gfx::NativeViewAccessible DesktopWindowTreeHostWin::GetNativeViewAccessible() {
@@ -700,7 +689,6 @@ void DesktopWindowTreeHostWin::HandleCancelMode() {
 
 void DesktopWindowTreeHostWin::HandleCaptureLost() {
   OnHostLostWindowCapture();
-  native_widget_delegate_->OnMouseCaptureLost();
 }
 
 void DesktopWindowTreeHostWin::HandleClose() {
@@ -864,7 +852,9 @@ bool DesktopWindowTreeHostWin::HandlePaintAccelerated(
 }
 
 void DesktopWindowTreeHostWin::HandlePaint(gfx::Canvas* canvas) {
-  compositor()->ScheduleRedrawRect(gfx::Rect());
+  // It appears possible to get WM_PAINT after WM_DESTROY.
+  if (compositor())
+    compositor()->ScheduleRedrawRect(gfx::Rect());
 }
 
 bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param,
@@ -873,13 +863,6 @@ bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param,
   return tooltip_ && tooltip_->HandleNotify(w_param, l_param, l_result);
 }
 
-void DesktopWindowTreeHostWin::HandleTooltipMouseMove(UINT message,
-                                                      WPARAM w_param,
-                                                      LPARAM l_param) {
-  // TooltipWin implementation doesn't need this.
-  // TODO(sky): remove from HWNDMessageHandler once non-aura path nuked.
-}
-
 void DesktopWindowTreeHostWin::HandleMenuLoop(bool in_menu_loop) {
   if (in_menu_loop) {
     tooltip_disabler_.reset(