summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/views/aura/aura_init.cc96
-rw-r--r--chrome/browser/ui/views/aura/aura_init.h16
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc4
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc3
4 files changed, 117 insertions, 2 deletions
diff --git a/chrome/browser/ui/views/aura/aura_init.cc b/chrome/browser/ui/views/aura/aura_init.cc
new file mode 100644
index 0000000..b88e080
--- /dev/null
+++ b/chrome/browser/ui/views/aura/aura_init.cc
@@ -0,0 +1,96 @@
+// Copyright (c) 2011 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 "chrome/browser/ui/views/aura/aura_init.h"
+
+#include "aura/desktop.h"
+#include "aura/window_delegate.h"
+#include "chrome/browser/ui/views/chrome_views_delegate.h"
+#include "ui/gfx/canvas_skia.h"
+#include "views/view.h"
+#include "views/widget/widget.h"
+
+namespace browser {
+
+namespace {
+
+// Trivial WindowDelegate implementation that draws a colored background.
+class DemoWindowDelegate : public aura::WindowDelegate {
+ public:
+ explicit DemoWindowDelegate(SkColor color) : color_(color) {}
+
+ // Overridden from aura::WindowDelegate:
+ virtual void OnFocus() OVERRIDE {}
+ virtual void OnBlur() OVERRIDE {}
+ virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE {
+ return false;
+ }
+ virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
+ return HTCLIENT;
+ }
+ virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE {
+ return true;
+ }
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
+ canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode);
+ }
+ virtual void OnWindowDestroying() OVERRIDE {
+ }
+ virtual void OnWindowDestroyed() OVERRIDE {
+ delete this;
+ }
+
+ private:
+ SkColor color_;
+
+ DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate);
+};
+
+
+class TestView : public views::View {
+ public:
+ TestView() {}
+ virtual ~TestView() {}
+
+ virtual void OnPaint(gfx::Canvas* canvas) {
+ canvas->FillRectInt(SK_ColorRED, 0, 0, width(), height());
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestView);
+};
+
+} // namespace
+
+void InitAuraDesktop() {
+ aura::Desktop::GetInstance();
+ views::Widget* widget = new views::Widget;
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
+ params.bounds = gfx::Rect(0, 0, 1024, 768);
+ widget->Init(params);
+ widget->SetContentsView(new views::View);
+ widget->Show();
+ ChromeViewsDelegate* chrome_views_delegate =
+ static_cast<ChromeViewsDelegate*>(views::ViewsDelegate::views_delegate);
+ chrome_views_delegate->default_parent_view = widget->GetContentsView();
+ aura::Desktop::GetInstance()->Show();
+
+ views::Widget* widget2 = new views::Widget;
+ views::Widget::InitParams params2(views::Widget::InitParams::TYPE_CONTROL);
+ params2.bounds = gfx::Rect(75, 75, 80, 80);
+ params2.parent = aura::Desktop::GetInstance()->window();
+ widget2->Init(params2);
+ widget2->SetContentsView(new TestView);
+ widget2->Show();
+
+ DemoWindowDelegate* window_delegate1 = new DemoWindowDelegate(SK_ColorBLUE);
+ aura::Window* window1 = new aura::Window(window_delegate1);
+ window1->set_id(1);
+ window1->Init();
+ window1->SetBounds(gfx::Rect(100, 100, 400, 400), 0);
+ window1->SetVisibility(aura::Window::VISIBILITY_SHOWN);
+ window1->SetParent(NULL);
+}
+
+} // namespace browser
diff --git a/chrome/browser/ui/views/aura/aura_init.h b/chrome/browser/ui/views/aura/aura_init.h
new file mode 100644
index 0000000..d516e67
--- /dev/null
+++ b/chrome/browser/ui/views/aura/aura_init.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_AURA_AURA_INIT_H_
+#define CHROME_BROWSER_UI_VIEWS_AURA_AURA_INIT_H_
+#pragma once
+
+namespace browser {
+
+// Creates and shows the Aura Desktop. Called from BrowserMain().
+void InitAuraDesktop();
+
+}
+
+#endif // CHROME_BROWSER_UI_VIEWS_AURA_AURA_INIT_H_
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
index 2ba0c18..7bbb395 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.h"
#include "chrome/browser/ui/view_ids.h"
+#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#include "content/browser/renderer_host/render_widget_host_view_win.h"
@@ -102,5 +103,6 @@ gfx::NativeViewAccessible
// static
NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer(
TabContentsContainer* container) {
- return new NativeTabContentsContainerAura(container);
+ return new NativeTabContentsContainerViews(container);
+ // TODO(beng): return new NativeTabContentsContainerAura(container);
}
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
index 8aa2df6..f7235b2 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
@@ -110,5 +110,6 @@ views::NativeWidget* NativeTabContentsViewAura::AsNativeWidget() {
// static
NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView(
internal::NativeTabContentsViewDelegate* delegate) {
- return new NativeTabContentsViewAura(delegate);
+ return new NativeTabContentsViewViews(delegate);
+ // return new NativeTabContentsViewAura(delegate);
}