| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_screen.h" | 5 #include "extensions/shell/browser/shell_screen.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 ShellScreen::~ShellScreen() { | 34 ShellScreen::~ShellScreen() { |
| 35 DCHECK(!host_) << "Window not closed before destroying ShellScreen"; | 35 DCHECK(!host_) << "Window not closed before destroying ShellScreen"; |
| 36 } | 36 } |
| 37 | 37 |
| 38 aura::WindowTreeHost* ShellScreen::CreateHostForPrimaryDisplay() { | 38 aura::WindowTreeHost* ShellScreen::CreateHostForPrimaryDisplay() { |
| 39 DCHECK(!host_); | 39 DCHECK(!host_); |
| 40 host_ = aura::WindowTreeHost::Create( | 40 host_ = aura::WindowTreeHost::Create( |
| 41 gfx::Rect(GetPrimaryDisplay().GetSizeInPixel())); | 41 gfx::Rect(GetPrimaryDisplay().GetSizeInPixel())); |
| 42 host_->window()->AddObserver(this); | 42 host_->window()->AddObserver(this); |
| 43 host_->InitHost(); | 43 host_->InitHost(); |
| 44 host_->window()->Show(); |
| 44 return host_; | 45 return host_; |
| 45 } | 46 } |
| 46 | 47 |
| 47 // aura::WindowObserver overrides: | 48 // aura::WindowObserver overrides: |
| 48 | 49 |
| 49 void ShellScreen::OnWindowBoundsChanged(aura::Window* window, | 50 void ShellScreen::OnWindowBoundsChanged(aura::Window* window, |
| 50 const gfx::Rect& old_bounds, | 51 const gfx::Rect& old_bounds, |
| 51 const gfx::Rect& new_bounds) { | 52 const gfx::Rect& new_bounds) { |
| 52 DCHECK_EQ(host_->window(), window); | 53 DCHECK_EQ(host_->window(), window); |
| 53 display::Display display(GetPrimaryDisplay()); | 54 display::Display display(GetPrimaryDisplay()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 74 gfx::NativeWindow ShellScreen::GetWindowAtScreenPoint(const gfx::Point& point) { | 75 gfx::NativeWindow ShellScreen::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 75 return host_->window()->GetTopWindowContainingPoint(point); | 76 return host_->window()->GetTopWindowContainingPoint(point); |
| 76 } | 77 } |
| 77 | 78 |
| 78 display::Display ShellScreen::GetDisplayNearestWindow( | 79 display::Display ShellScreen::GetDisplayNearestWindow( |
| 79 gfx::NativeWindow window) const { | 80 gfx::NativeWindow window) const { |
| 80 return GetPrimaryDisplay(); | 81 return GetPrimaryDisplay(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace extensions | 84 } // namespace extensions |
| OLD | NEW |