blob: 61bc8079ac6d655bc65a2204b774dd75d07c8e55 [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/browser/shell.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/shell/browser/shell_platform_data_aura.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/test_screen.h"
#include "ui/aura/window.h"
namespace content {
// static
void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
CHECK(!platform_);
aura::TestScreen* screen = aura::TestScreen::Create();
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen);
platform_ = new ShellPlatformDataAura(default_window_size);
}
void Shell::PlatformExit() {
CHECK(platform_);
delete platform_;
platform_ = NULL;
aura::Env::DeleteInstance();
}
void Shell::PlatformCleanUp() {
}
void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
}
void Shell::PlatformSetAddressBarURL(const GURL& url) {
}
void Shell::PlatformSetIsLoading(bool loading) {
}
void Shell::PlatformCreateWindow(int width, int height) {
CHECK(platform_);
if (!headless_)
platform_->ShowWindow();
platform_->ResizeWindow(gfx::Size(width, height));
}
void Shell::PlatformSetContents() {
CHECK(platform_);
aura::Window* content = web_contents_->GetView()->GetNativeView();
aura::Window* parent = platform_->window()->window();
if (parent->Contains(content))
return;
parent->AddChild(content);
content->Show();
}
void Shell::PlatformResizeSubViews() {
}
void Shell::Close() {
if (headless_)
delete this;
else
web_contents_.reset();
}
void Shell::PlatformSetTitle(const base::string16& title) {
}
} // namespace content