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

Side by Side Diff: blimp/client/app/linux/blimp_display_manager.cc

Issue 2504793002: Scale bounds in DesktopWindowTreeHostMus and in calls to SetBounds. (Closed)
Patch Set: SetBounds + rebase Created 4 years, 1 month 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
« no previous file with comments | « no previous file | blimp/client/public/contents/blimp_contents_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/client/app/linux/blimp_display_manager.h" 5 #include "blimp/client/app/linux/blimp_display_manager.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "blimp/client/app/compositor/browser_compositor.h" 8 #include "blimp/client/app/compositor/browser_compositor.h"
9 #include "blimp/client/public/compositor/compositor_dependencies.h" 9 #include "blimp/client/public/compositor/compositor_dependencies.h"
10 #include "blimp/client/public/contents/blimp_contents.h" 10 #include "blimp/client/public/contents/blimp_contents.h"
11 #include "blimp/client/public/contents/blimp_contents_view.h" 11 #include "blimp/client/public/contents/blimp_contents_view.h"
12 #include "blimp/client/public/contents/blimp_navigation_controller.h" 12 #include "blimp/client/public/contents/blimp_navigation_controller.h"
13 #include "ui/events/event.h" 13 #include "ui/events/event.h"
14 #include "ui/events/gesture_detection/motion_event_generic.h" 14 #include "ui/events/gesture_detection/motion_event_generic.h"
15 #include "ui/events/gestures/motion_event_aura.h" 15 #include "ui/events/gestures/motion_event_aura.h"
16 #include "ui/events/platform/platform_event_source.h" 16 #include "ui/events/platform/platform_event_source.h"
17 #include "ui/gfx/geometry/dip_util.h"
17 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
18 #include "ui/platform_window/platform_window.h" 19 #include "ui/platform_window/platform_window.h"
19 #include "ui/platform_window/x11/x11_window.h" 20 #include "ui/platform_window/x11/x11_window.h"
20 21
21 namespace blimp { 22 namespace blimp {
22 namespace { 23 namespace {
23 constexpr int kPointer1Id = 0; 24 constexpr int kPointer1Id = 0;
24 constexpr int kPointer2Id = 1; 25 constexpr int kPointer2Id = 1;
25 constexpr int kZoomOffsetMultiplier = 4; 26 constexpr int kZoomOffsetMultiplier = 4;
26 } // namespace 27 } // namespace
27 28
28 namespace client { 29 namespace client {
29 30
30 BlimpDisplayManager::BlimpDisplayManager( 31 BlimpDisplayManager::BlimpDisplayManager(
31 BlimpDisplayManagerDelegate* delegate, 32 BlimpDisplayManagerDelegate* delegate,
32 CompositorDependencies* compositor_dependencies) 33 CompositorDependencies* compositor_dependencies)
33 : device_pixel_ratio_(1.f), 34 : device_pixel_ratio_(1.f),
34 delegate_(delegate), 35 delegate_(delegate),
35 platform_event_source_(ui::PlatformEventSource::CreateDefault()), 36 platform_event_source_(ui::PlatformEventSource::CreateDefault()),
36 platform_window_(new ui::X11Window(this)) { 37 platform_window_(new ui::X11Window(this)) {
37 compositor_ = base::MakeUnique<BrowserCompositor>(compositor_dependencies); 38 compositor_ = base::MakeUnique<BrowserCompositor>(compositor_dependencies);
38 } 39 }
39 40
40 BlimpDisplayManager::~BlimpDisplayManager() = default; 41 BlimpDisplayManager::~BlimpDisplayManager() = default;
41 42
42 void BlimpDisplayManager::SetWindowSize(const gfx::Size& window_size) { 43 void BlimpDisplayManager::SetWindowSize(const gfx::Size& window_size) {
43 platform_window_->SetBounds(gfx::Rect(window_size)); 44 platform_window_->SetBounds(
45 gfx::ConvertRectToPixel(device_pixel_ratio_, gfx::Rect(window_size)));
44 } 46 }
45 47
46 void BlimpDisplayManager::SetBlimpContents( 48 void BlimpDisplayManager::SetBlimpContents(
47 std::unique_ptr<BlimpContents> contents) { 49 std::unique_ptr<BlimpContents> contents) {
48 contents_ = std::move(contents); 50 contents_ = std::move(contents);
49 compositor_->SetContentLayer(contents_->GetView()->GetLayer()); 51 compositor_->SetContentLayer(contents_->GetView()->GetLayer());
50 platform_window_->Show(); 52 platform_window_->Show();
51 } 53 }
52 54
53 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) { 55 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 181 }
180 182
181 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { 183 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() {
182 DCHECK(contents_); 184 DCHECK(contents_);
183 contents_->Hide(); 185 contents_->Hide();
184 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); 186 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
185 } 187 }
186 188
187 } // namespace client 189 } // namespace client
188 } // namespace blimp 190 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | blimp/client/public/contents/blimp_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698