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

Side by Side Diff: headless/lib/browser/headless_screen.cc

Issue 2567293004: Makes WindowTreeHost::InitHost() not Show the window (Closed)
Patch Set: WTF::Show shows window Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "headless/lib/browser/headless_screen.h" 5 #include "headless/lib/browser/headless_screen.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
(...skipping 25 matching lines...) Expand all
36 36
37 aura::WindowTreeHost* HeadlessScreen::CreateHostForPrimaryDisplay() { 37 aura::WindowTreeHost* HeadlessScreen::CreateHostForPrimaryDisplay() {
38 DCHECK(!host_); 38 DCHECK(!host_);
39 host_ = aura::WindowTreeHost::Create( 39 host_ = aura::WindowTreeHost::Create(
40 gfx::Rect(GetPrimaryDisplay().GetSizeInPixel())); 40 gfx::Rect(GetPrimaryDisplay().GetSizeInPixel()));
41 // Some tests don't correctly manage window focus/activation states. 41 // Some tests don't correctly manage window focus/activation states.
42 // Makes sure InputMethod is default focused so that IME basics can work. 42 // Makes sure InputMethod is default focused so that IME basics can work.
43 host_->GetInputMethod()->OnFocus(); 43 host_->GetInputMethod()->OnFocus();
44 host_->window()->AddObserver(this); 44 host_->window()->AddObserver(this);
45 host_->InitHost(); 45 host_->InitHost();
46 host_->window()->Show();
46 return host_; 47 return host_;
47 } 48 }
48 49
49 void HeadlessScreen::SetDeviceScaleFactor(float device_scale_factor) { 50 void HeadlessScreen::SetDeviceScaleFactor(float device_scale_factor) {
50 display::Display display(GetPrimaryDisplay()); 51 display::Display display(GetPrimaryDisplay());
51 gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); 52 gfx::Rect bounds_in_pixel(display.GetSizeInPixel());
52 display.SetScaleAndBounds(device_scale_factor, bounds_in_pixel); 53 display.SetScaleAndBounds(device_scale_factor, bounds_in_pixel);
53 display_list().UpdateDisplay(display); 54 display_list().UpdateDisplay(display);
54 } 55 }
55 56
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) 152 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds)
152 : host_(NULL), ui_scale_(1.0f) { 153 : host_(NULL), ui_scale_(1.0f) {
153 static int64_t synthesized_display_id = 2000; 154 static int64_t synthesized_display_id = 2000;
154 display::Display display(synthesized_display_id++); 155 display::Display display(synthesized_display_id++);
155 display.SetScaleAndBounds(1.0f, screen_bounds); 156 display.SetScaleAndBounds(1.0f, screen_bounds);
156 ProcessDisplayChanged(display, true /* is_primary */); 157 ProcessDisplayChanged(display, true /* is_primary */);
157 } 158 }
158 159
159 } // namespace headless 160 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698