Don't add extra app list launcher page webviews.
[chromium-blink-merge.git] / extensions / shell / browser / shell_desktop_controller_mac.mm
blob8aebc8e91286c3b3cc53e5db2b5d13be34e99253
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
3 // found in the LICENSE file.
5 #include "extensions/shell/browser/shell_desktop_controller_mac.h"
7 #include "extensions/browser/app_window/native_app_window.h"
8 #include "extensions/shell/browser/shell_app_window_client.h"
9 #include "extensions/shell/browser/shell_app_delegate.h"
10 #include "ui/gfx/display.h"
11 #include "ui/gfx/geometry/size.h"
12 #include "ui/gfx/screen.h"
14 namespace extensions {
16 ShellDesktopControllerMac::ShellDesktopControllerMac()
17     : app_window_client_(new ShellAppWindowClient), app_window_(NULL) {
18   AppWindowClient::Set(app_window_client_.get());
21 ShellDesktopControllerMac::~ShellDesktopControllerMac() {
22   // TOOD(yoz): This is actually too late to close app windows (for tests).
23   // Maybe this is useful for non-tests.
24   CloseAppWindows();
27 gfx::Size ShellDesktopControllerMac::GetWindowSize() {
28   // This is the full screen size.
29   return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().bounds().size();
32 AppWindow* ShellDesktopControllerMac::CreateAppWindow(
33     content::BrowserContext* context,
34     const Extension* extension) {
35   app_window_ = new AppWindow(context, new ShellAppDelegate, extension);
36   return app_window_;
39 void ShellDesktopControllerMac::AddAppWindow(gfx::NativeWindow window) {
42 void ShellDesktopControllerMac::RemoveAppWindow(AppWindow* window) {
45 void ShellDesktopControllerMac::CloseAppWindows() {
46   if (app_window_) {
47     ui::BaseWindow* window = app_window_->GetBaseWindow();
48     window->Close();  // Close() deletes |app_window_|.
49     app_window_ = NULL;
50   }
53 }  // namespace extensions