summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aura/desktop.cc6
-rw-r--r--aura/desktop.h3
-rw-r--r--aura/desktop_host_win.cc9
-rw-r--r--chrome/browser/chrome_browser_main.cc7
-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
-rw-r--r--chrome/chrome_browser.gypi7
-rw-r--r--views/view.cc2
-rw-r--r--views/widget/native_widget_aura.cc8
-rw-r--r--views/widget/native_widget_views.cc3
12 files changed, 151 insertions, 13 deletions
diff --git a/aura/desktop.cc b/aura/desktop.cc
index c89e229..171da3c 100644
--- a/aura/desktop.cc
+++ b/aura/desktop.cc
@@ -60,6 +60,12 @@ bool Desktop::OnKeyEvent(const KeyEvent& event) {
return window_->HandleKeyEvent(event);
}
+void Desktop::OnHostResized(const gfx::Size& size) {
+ gfx::Rect bounds(window_->bounds().origin(), size);
+ window_->SetBounds(bounds, 0);
+ compositor_->WidgetSizeChanged(size);
+}
+
void Desktop::ScheduleCompositorPaint() {
if (schedule_paint_.empty()) {
MessageLoop::current()->PostTask(FROM_HERE,
diff --git a/aura/desktop.h b/aura/desktop.h
index e7632ad..0a2c2ae 100644
--- a/aura/desktop.h
+++ b/aura/desktop.h
@@ -47,6 +47,9 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate {
// Handles a key event. Returns true if handled.
bool OnKeyEvent(const KeyEvent& event);
+ // Called when the host changes size.
+ void OnHostResized(const gfx::Size& size);
+
// Compositor we're drawing to.
ui::Compositor* compositor() { return compositor_.get(); }
diff --git a/aura/desktop_host_win.cc b/aura/desktop_host_win.cc
index e0a3d16..f191be6 100644
--- a/aura/desktop_host_win.cc
+++ b/aura/desktop_host_win.cc
@@ -85,17 +85,12 @@ LRESULT DesktopHostWin::OnMouseRange(UINT message,
}
void DesktopHostWin::OnPaint(HDC dc) {
- if (desktop_)
- desktop_->Draw();
+ desktop_->Draw();
ValidateRect(hwnd(), NULL);
}
void DesktopHostWin::OnSize(UINT param, const CSize& size) {
- if (desktop_) {
- gfx::Rect bounds(desktop_->window()->bounds().origin(),
- gfx::Size(size.cx, size.cy));
- desktop_->window()->SetBounds(bounds, 0);
- }
+ desktop_->OnHostResized(gfx::Size(size.cx, size.cy));
}
} // namespace aura
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index f5f0a00..e30f983 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -195,6 +195,10 @@
#include "views/touchui/touch_factory.h"
#endif
+#if defined(USE_AURA)
+#include "chrome/browser/ui/views/aura/aura_init.h"
+#endif
+
namespace net {
class NetLog;
} // namespace net
@@ -1352,6 +1356,9 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() {
}
}
#endif
+#if defined(USE_AURA)
+ browser::InitAuraDesktop();
+#endif
InitializeNetworkOptions(parsed_command_line());
InitializeURLRequestThrottlerManager(browser_process_->net_log());
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);
}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index fec8fd2..0675404 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3124,6 +3124,8 @@
'browser/ui/views/app_menu_button_win.h',
'browser/ui/views/appcache_info_view.cc',
'browser/ui/views/appcache_info_view.h',
+ 'browser/ui/views/aura/aura_init.cc',
+ 'browser/ui/views/aura/aura_init.h',
'browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc',
'browser/ui/views/autocomplete/autocomplete_popup_contents_view.h',
'browser/ui/views/autocomplete/autocomplete_result_view.cc',
@@ -4008,6 +4010,11 @@
],
},
}],
+ ['use_aura==0', {
+ 'sources/': [
+ ['exclude', '^browser/ui/views/aura/*'],
+ ],
+ }],
['use_aura==1', {
'sources/': [
['exclude', '^browser/aeropeek_manager.cc'],
diff --git a/views/view.cc b/views/view.cc
index fff2386..77c7976 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -44,7 +44,7 @@ namespace {
// Whether to use accelerated compositing when necessary (e.g. when a view has a
// transformation).
-#if !defined(OS_CHROMEOS) || defined(TOUCH_UI)
+#if !defined(OS_CHROMEOS) || defined(TOUCH_UI) || defined(USE_AURA)
bool use_acceleration_when_possible = true;
#else
bool use_acceleration_when_possible = false;
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc
index 193df98..58c4e32 100644
--- a/views/widget/native_widget_aura.cc
+++ b/views/widget/native_widget_aura.cc
@@ -116,7 +116,8 @@ void NativeWidgetAura::MarkLayerDirty() {
void NativeWidgetAura::CalculateOffsetToAncestorWithLayer(gfx::Point* offset,
View** ancestor) {
- //NOTIMPLEMENTED();
+ if (ancestor)
+ *ancestor = GetWidget()->GetRootView();
}
void NativeWidgetAura::ViewRemoved(View* view) {
@@ -267,6 +268,7 @@ void NativeWidgetAura::ShowMaximizedWithBounds(
}
void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) {
+ window_->SetVisibility(aura::Window::VISIBILITY_SHOWN);
NOTIMPLEMENTED();
}
@@ -283,7 +285,7 @@ void NativeWidgetAura::Deactivate() {
}
bool NativeWidgetAura::IsActive() const {
- NOTIMPLEMENTED();
+ //NOTIMPLEMENTED();
return false;
}
@@ -318,7 +320,7 @@ void NativeWidgetAura::SetFullscreen(bool fullscreen) {
}
bool NativeWidgetAura::IsFullscreen() const {
- NOTIMPLEMENTED();
+ //NOTIMPLEMENTED();
return false;
}
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc
index da4d898..44f2d9d 100644
--- a/views/widget/native_widget_views.cc
+++ b/views/widget/native_widget_views.cc
@@ -111,7 +111,10 @@ void NativeWidgetViews::InitNativeWidget(const Widget::InitParams& params) {
view_ = new internal::NativeWidgetView(this);
view_->SetBoundsRect(params.bounds);
+#if !defined(USE_AURA)
+ // TODO(beng): re-enable this once we have a consolidated layer tree.
view_->SetPaintToLayer(true);
+#endif
// With the default NATIVE_WIDGET_OWNS_WIDGET ownership, the
// deletion of either of the NativeWidgetViews or NativeWidgetView