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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc

Issue 2207043002: SetDeviceScaleFactorForTest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetDeviceScaleFactorForTest Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/client/cursor_client.h" 11 #include "ui/aura/client/cursor_client.h"
12 #include "ui/aura/client/focus_client.h" 12 #include "ui/aura/client/focus_client.h"
13 #include "ui/aura/window_event_dispatcher.h" 13 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/aura/window_property.h" 14 #include "ui/aura/window_property.h"
15 #include "ui/base/cursor/cursor_loader_win.h" 15 #include "ui/base/cursor/cursor_loader_win.h"
16 #include "ui/base/ime/input_method.h" 16 #include "ui/base/ime/input_method.h"
17 #include "ui/base/win/shell.h" 17 #include "ui/base/win/shell.h"
18 #include "ui/compositor/compositor_constants.h" 18 #include "ui/compositor/compositor_constants.h"
19 #include "ui/compositor/paint_context.h" 19 #include "ui/compositor/paint_context.h"
20 #include "ui/display/display.h"
20 #include "ui/display/win/dpi.h" 21 #include "ui/display/win/dpi.h"
21 #include "ui/display/win/screen_win.h" 22 #include "ui/display/win/screen_win.h"
22 #include "ui/gfx/geometry/insets.h" 23 #include "ui/gfx/geometry/insets.h"
23 #include "ui/gfx/geometry/vector2d.h" 24 #include "ui/gfx/geometry/vector2d.h"
24 #include "ui/gfx/native_widget_types.h" 25 #include "ui/gfx/native_widget_types.h"
25 #include "ui/gfx/path.h" 26 #include "ui/gfx/path.h"
26 #include "ui/gfx/path_win.h" 27 #include "ui/gfx/path_win.h"
27 #include "ui/native_theme/native_theme_aura.h" 28 #include "ui/native_theme/native_theme_aura.h"
28 #include "ui/native_theme/native_theme_win.h" 29 #include "ui/native_theme/native_theme_win.h"
29 #include "ui/views/corewm/tooltip_win.h" 30 #include "ui/views/corewm/tooltip_win.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 DesktopNativeWidgetAura* desktop_native_widget_aura) 81 DesktopNativeWidgetAura* desktop_native_widget_aura)
81 : message_handler_(new HWNDMessageHandler(this)), 82 : message_handler_(new HWNDMessageHandler(this)),
82 native_widget_delegate_(native_widget_delegate), 83 native_widget_delegate_(native_widget_delegate),
83 desktop_native_widget_aura_(desktop_native_widget_aura), 84 desktop_native_widget_aura_(desktop_native_widget_aura),
84 content_window_(NULL), 85 content_window_(NULL),
85 drag_drop_client_(NULL), 86 drag_drop_client_(NULL),
86 should_animate_window_close_(false), 87 should_animate_window_close_(false),
87 pending_close_(false), 88 pending_close_(false),
88 has_non_client_view_(false), 89 has_non_client_view_(false),
89 tooltip_(NULL) { 90 tooltip_(NULL) {
91 display::Screen::GetScreen()->AddObserver(this);
90 } 92 }
91 93
92 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { 94 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() {
95 display::Screen::GetScreen()->RemoveObserver(this);
93 // WARNING: |content_window_| has been destroyed by the time we get here. 96 // WARNING: |content_window_| has been destroyed by the time we get here.
94 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); 97 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
95 DestroyDispatcher(); 98 DestroyDispatcher();
96 } 99 }
97 100
98 // static 101 // static
99 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { 102 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) {
100 // All HWND's we create should have WindowTreeHost instances associated with 103 // All HWND's we create should have WindowTreeHost instances associated with
101 // them. There are exceptions like the content layer creating HWND's which 104 // them. There are exceptions like the content layer creating HWND's which
102 // are not associated with WindowTreeHost instances. 105 // are not associated with WindowTreeHost instances.
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 window_expansion_bottom_right_delta_ = bottom_right_delta; 595 window_expansion_bottom_right_delta_ = bottom_right_delta;
593 SetBounds(bounds_without_expansion); 596 SetBounds(bounds_without_expansion);
594 } 597 }
595 598
596 void DesktopWindowTreeHostWin::OnWindowHidingAnimationCompleted() { 599 void DesktopWindowTreeHostWin::OnWindowHidingAnimationCompleted() {
597 if (pending_close_) 600 if (pending_close_)
598 message_handler_->Close(); 601 message_handler_->Close();
599 } 602 }
600 603
601 //////////////////////////////////////////////////////////////////////////////// 604 ////////////////////////////////////////////////////////////////////////////////
605 // DesktopWindowTreeHostWin, DisplayObserver implementation:
606 void DesktopWindowTreeHostWin::OnDisplayMetricsChanged(
607 const display::Display& display,
608 uint32_t changed_metrics) {
609 display::Screen* screen = display::Screen::GetScreen();
610 if ((changed_metrics & DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR) &&
611 screen->GetDisplayNearestWindow(window()).id() == display.id()) {
612 HandleWindowScaleFactorChanged(display.device_scale_factor());
613 }
614 }
615
616 ////////////////////////////////////////////////////////////////////////////////
602 // DesktopWindowTreeHostWin, HWNDMessageHandlerDelegate implementation: 617 // DesktopWindowTreeHostWin, HWNDMessageHandlerDelegate implementation:
603 618
604 bool DesktopWindowTreeHostWin::HasNonClientView() const { 619 bool DesktopWindowTreeHostWin::HasNonClientView() const {
605 return has_non_client_view_; 620 return has_non_client_view_;
606 } 621 }
607 622
608 FrameMode DesktopWindowTreeHostWin::GetFrameMode() const { 623 FrameMode DesktopWindowTreeHostWin::GetFrameMode() const {
609 return GetWidget()->ShouldUseNativeFrame() ? FrameMode::SYSTEM_DRAWN 624 return GetWidget()->ShouldUseNativeFrame() ? FrameMode::SYSTEM_DRAWN
610 : FrameMode::CUSTOM_DRAWN; 625 : FrameMode::CUSTOM_DRAWN;
611 } 626 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 1012
998 // static 1013 // static
999 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 1014 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
1000 internal::NativeWidgetDelegate* native_widget_delegate, 1015 internal::NativeWidgetDelegate* native_widget_delegate,
1001 DesktopNativeWidgetAura* desktop_native_widget_aura) { 1016 DesktopNativeWidgetAura* desktop_native_widget_aura) {
1002 return new DesktopWindowTreeHostWin(native_widget_delegate, 1017 return new DesktopWindowTreeHostWin(native_widget_delegate,
1003 desktop_native_widget_aura); 1018 desktop_native_widget_aura);
1004 } 1019 }
1005 1020
1006 } // namespace views 1021 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698