1// Copyright 2013 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.
4
5#include "content/shell/browser/shell.h"
6
7#include "content/public/browser/web_contents.h"
8#include "content/shell/browser/shell_platform_data_aura.h"
9#include "ui/aura/env.h"
10#include "ui/aura/test/test_screen.h"
11#include "ui/aura/window.h"
12#include "ui/aura/window_event_dispatcher.h"
13
14namespace content {
15
16// static
17void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
18  CHECK(!platform_);
19  aura::TestScreen* screen = aura::TestScreen::Create(gfx::Size());
20  gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen);
21  platform_ = new ShellPlatformDataAura(default_window_size);
22}
23
24void Shell::PlatformExit() {
25  CHECK(platform_);
26  delete platform_;
27  platform_ = NULL;
28  aura::Env::DeleteInstance();
29}
30
31void Shell::PlatformCleanUp() {
32}
33
34void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
35}
36
37void Shell::PlatformSetAddressBarURL(const GURL& url) {
38}
39
40void Shell::PlatformSetIsLoading(bool loading) {
41}
42
43void Shell::PlatformCreateWindow(int width, int height) {
44  CHECK(platform_);
45  if (!headless_)
46    platform_->ShowWindow();
47  platform_->ResizeWindow(gfx::Size(width, height));
48}
49
50void Shell::PlatformSetContents() {
51  CHECK(platform_);
52  aura::Window* content = web_contents_->GetNativeView();
53  aura::Window* parent = platform_->host()->window();
54  if (!parent->Contains(content))
55    parent->AddChild(content);
56
57  content->Show();
58}
59
60void Shell::PlatformResizeSubViews() {
61}
62
63void Shell::Close() {
64  delete this;
65}
66
67void Shell::PlatformSetTitle(const base::string16& title) {
68}
69
70bool Shell::PlatformHandleContextMenu(
71    const content::ContextMenuParams& params) {
72  return false;
73}
74
75}  // namespace content
76