| OLD | NEW |
| 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/aura/test/test_screen.h" | 5 #include "ui/aura/test/test_screen.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 TestScreen* TestScreen::CreateFullscreen() { | 27 TestScreen* TestScreen::CreateFullscreen() { |
| 28 return new TestScreen(gfx::Rect(WindowTreeHost::GetNativeScreenSize())); | 28 return new TestScreen(gfx::Rect(WindowTreeHost::GetNativeScreenSize())); |
| 29 } | 29 } |
| 30 | 30 |
| 31 TestScreen::~TestScreen() { | 31 TestScreen::~TestScreen() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 WindowTreeHost* TestScreen::CreateHostForPrimaryDisplay() { | 34 WindowTreeHost* TestScreen::CreateHostForPrimaryDisplay( |
| 35 ui::ContextFactory* context_factory) { |
| 35 DCHECK(!host_); | 36 DCHECK(!host_); |
| 36 host_ = WindowTreeHost::Create(gfx::Rect(display_.GetSizeInPixel())); | 37 host_ = WindowTreeHost::Create(gfx::Rect(display_.GetSizeInPixel()), |
| 38 context_factory); |
| 37 host_->window()->AddObserver(this); | 39 host_->window()->AddObserver(this); |
| 38 host_->InitHost(); | 40 host_->InitHost(); |
| 39 return host_; | 41 return host_; |
| 40 } | 42 } |
| 41 | 43 |
| 42 void TestScreen::SetDeviceScaleFactor(float device_scale_factor) { | 44 void TestScreen::SetDeviceScaleFactor(float device_scale_factor) { |
| 43 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); | 45 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); |
| 44 display_.SetScaleAndBounds(device_scale_factor, bounds_in_pixel); | 46 display_.SetScaleAndBounds(device_scale_factor, bounds_in_pixel); |
| 45 host_->OnHostResized(bounds_in_pixel.size()); | 47 host_->OnHostResized(bounds_in_pixel.size()); |
| 46 } | 48 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 153 |
| 152 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 154 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
| 153 : host_(NULL), | 155 : host_(NULL), |
| 154 ui_scale_(1.0f) { | 156 ui_scale_(1.0f) { |
| 155 static int64 synthesized_display_id = 2000; | 157 static int64 synthesized_display_id = 2000; |
| 156 display_.set_id(synthesized_display_id++); | 158 display_.set_id(synthesized_display_id++); |
| 157 display_.SetScaleAndBounds(1.0f, screen_bounds); | 159 display_.SetScaleAndBounds(1.0f, screen_bounds); |
| 158 } | 160 } |
| 159 | 161 |
| 160 } // namespace aura | 162 } // namespace aura |
| OLD | NEW |