Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / shell / browser / shell_aura.cc
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
14 namespace content {
15
16 // static
17 void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
18   CHECK(!platform_);
19   aura::TestScreen* screen = aura::TestScreen::Create();
20   gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen);
21   platform_ = new ShellPlatformDataAura(default_window_size);
22 }
23
24 void Shell::PlatformExit() {
25   CHECK(platform_);
26   delete platform_;
27   platform_ = NULL;
28   aura::Env::DeleteInstance();
29 }
30
31 void Shell::PlatformCleanUp() {
32 }
33
34 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
35 }
36
37 void Shell::PlatformSetAddressBarURL(const GURL& url) {
38 }
39
40 void Shell::PlatformSetIsLoading(bool loading) {
41 }
42
43 void Shell::PlatformCreateWindow(int width, int height) {
44   CHECK(platform_);
45   if (!headless_)
46     platform_->ShowWindow();
47   platform_->ResizeWindow(gfx::Size(width, height));
48 }
49
50 void 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     return;
56   parent->AddChild(content);
57   content->Show();
58 }
59
60 void Shell::PlatformResizeSubViews() {
61 }
62
63 void Shell::Close() {
64   delete this;
65 }
66
67 void Shell::PlatformSetTitle(const base::string16& title) {
68 }
69
70 bool Shell::PlatformHandleContextMenu(
71     const content::ContextMenuParams& params) {
72   return false;
73 }
74
75 }  // namespace content