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_desktop_controller.h" | 5 #include "extensions/shell/browser/shell_desktop_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "extensions/shell/browser/shell_app_window.h" | 8 #include "extensions/shell/browser/shell_app_window.h" |
9 #include "extensions/shell/common/switches.h" | 9 #include "extensions/shell/common/switches.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 ShellAppWindow* ShellDesktopController::CreateAppWindow( | 182 ShellAppWindow* ShellDesktopController::CreateAppWindow( |
183 content::BrowserContext* context, | 183 content::BrowserContext* context, |
184 const Extension* extension) { | 184 const Extension* extension) { |
185 aura::Window* root_window = GetHost()->window(); | 185 aura::Window* root_window = GetHost()->window(); |
186 | 186 |
187 app_window_.reset(new ShellAppWindow); | 187 app_window_.reset(new ShellAppWindow); |
188 app_window_->Init(context, extension, root_window->bounds().size()); | 188 app_window_->Init(context, extension, root_window->bounds().size()); |
189 | 189 |
190 // Attach the web contents view to our window hierarchy. | 190 // Attach the web contents view to our window hierarchy. |
191 aura::Window* content = app_window_->GetNativeWindow(); | 191 aura::Window* content = app_window_->GetNativeWindow(); |
192 root_window->AddChild(content); | 192 AddAppWindow(content); |
193 content->Show(); | 193 content->Show(); |
194 | 194 |
195 return app_window_.get(); | 195 return app_window_.get(); |
196 } | 196 } |
197 | 197 |
| 198 void ShellDesktopController::AddAppWindow(aura::Window* window) { |
| 199 aura::Window* root_window = GetHost()->window(); |
| 200 root_window->AddChild(window); |
| 201 } |
| 202 |
198 void ShellDesktopController::CloseAppWindows() { | 203 void ShellDesktopController::CloseAppWindows() { |
199 app_window_.reset(); | 204 app_window_.reset(); |
200 } | 205 } |
201 | 206 |
202 aura::Window* ShellDesktopController::GetDefaultParent( | 207 aura::Window* ShellDesktopController::GetDefaultParent( |
203 aura::Window* context, | 208 aura::Window* context, |
204 aura::Window* window, | 209 aura::Window* window, |
205 const gfx::Rect& bounds) { | 210 const gfx::Rect& bounds) { |
206 return host_->window(); | 211 return host_->window(); |
207 } | 212 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 if (displays.empty()) | 340 if (displays.empty()) |
336 return gfx::Size(); | 341 return gfx::Size(); |
337 const ui::DisplayMode* mode = displays[0].display->current_mode(); | 342 const ui::DisplayMode* mode = displays[0].display->current_mode(); |
338 return mode ? mode->size() : gfx::Size(); | 343 return mode ? mode->size() : gfx::Size(); |
339 #else | 344 #else |
340 return gfx::Size(); | 345 return gfx::Size(); |
341 #endif | 346 #endif |
342 } | 347 } |
343 | 348 |
344 } // namespace extensions | 349 } // namespace extensions |
OLD | NEW |