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