Commit 8d8c773c authored by ben@chromium.org's avatar ben@chromium.org

Re-land: Create a new views_aura_desktop.

Get views::Widget rendering working against an aura::Window NativeWidget.

http://crbug.com/93944
TEST=none

Original review URL: http://codereview.chromium.org/7741027
Review URL: http://codereview.chromium.org/7747032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98331 0039d316-1c4b-4281-b951-d872f2087c98
parent 93543752
...@@ -3,14 +3,12 @@ ...@@ -3,14 +3,12 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "aura/desktop.h" #include "aura/desktop.h"
#include "aura/desktop_host.h"
#include "aura/window.h" #include "aura/window.h"
#include "aura/window_delegate.h" #include "aura/window_delegate.h"
#include "base/at_exit.h" #include "base/at_exit.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/i18n/icu_util.h" #include "base/i18n/icu_util.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "third_party/skia/include/core/SkXfermode.h" #include "third_party/skia/include/core/SkXfermode.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_paths.h"
...@@ -20,32 +18,21 @@ ...@@ -20,32 +18,21 @@
namespace { namespace {
// Trivial WindowDelegate implementation that draws a blue background. // Trivial WindowDelegate implementation that draws a colored background.
class DemoWindowDelegate : public aura::WindowDelegate { class DemoWindowDelegate : public aura::WindowDelegate {
public: public:
explicit DemoWindowDelegate(aura::Window* window, SkColor color); explicit DemoWindowDelegate(SkColor color) : color_(color) {}
virtual void OnPaint(const gfx::Rect& bounds) OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode);
}
private: private:
aura::Window* window_;
SkColor color_; SkColor color_;
DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate);
}; };
DemoWindowDelegate::DemoWindowDelegate(aura::Window* window, SkColor color)
: window_(window),
color_(color) {
}
void DemoWindowDelegate::OnPaint(const gfx::Rect& bounds) {
scoped_ptr<gfx::Canvas> canvas(
gfx::Canvas::CreateCanvas(bounds.width(), bounds.height(), false));
canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode);
window_->SetCanvas(*canvas->AsCanvasSkia(), bounds.origin());
}
} // namespace } // namespace
...@@ -63,43 +50,34 @@ int main(int argc, char** argv) { ...@@ -63,43 +50,34 @@ int main(int argc, char** argv) {
base::MessagePumpX::DisableGtkMessagePump(); base::MessagePumpX::DisableGtkMessagePump();
#endif #endif
// Create the DesktopHost and Desktop. aura::Desktop::GetInstance();
scoped_ptr<aura::DesktopHost> host(
aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768)));
aura::Desktop desktop(host->GetAcceleratedWidget(), host->GetSize());
host->SetDesktop(&desktop);
// Create a hierarchy of test windows. // Create a hierarchy of test windows.
aura::Window window1(&desktop); DemoWindowDelegate window_delegate1(SK_ColorBLUE);
aura::Window window1(&window_delegate1);
window1.set_id(1); window1.set_id(1);
window1.Init();
window1.SetBounds(gfx::Rect(100, 100, 400, 400), 0); window1.SetBounds(gfx::Rect(100, 100, 400, 400), 0);
window1.SetVisibility(aura::Window::VISIBILITY_SHOWN); window1.SetVisibility(aura::Window::VISIBILITY_SHOWN);
DemoWindowDelegate window_delegate1(&window1, SK_ColorBLUE); window1.SetParent(NULL);
window1.set_delegate(&window_delegate1);
desktop.window()->AddChild(&window1);
aura::Window window2(&desktop); DemoWindowDelegate window_delegate2(SK_ColorRED);
aura::Window window2(&window_delegate2);
window2.set_id(2); window2.set_id(2);
window2.Init();
window2.SetBounds(gfx::Rect(200, 200, 350, 350), 0); window2.SetBounds(gfx::Rect(200, 200, 350, 350), 0);
window2.SetVisibility(aura::Window::VISIBILITY_SHOWN); window2.SetVisibility(aura::Window::VISIBILITY_SHOWN);
DemoWindowDelegate window_delegate2(&window2, SK_ColorRED); window2.SetParent(NULL);
window2.set_delegate(&window_delegate2);
desktop.window()->AddChild(&window2); DemoWindowDelegate window_delegate3(SK_ColorGREEN);
aura::Window window3(&window_delegate3);
aura::Window window3(&desktop);
window3.set_id(3); window3.set_id(3);
window3.Init();
window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0); window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0);
window3.SetVisibility(aura::Window::VISIBILITY_SHOWN); window3.SetVisibility(aura::Window::VISIBILITY_SHOWN);
DemoWindowDelegate window_delegate3(&window3, SK_ColorGREEN); window3.SetParent(&window2);
window3.set_delegate(&window_delegate3);
window2.AddChild(&window3);
host->Show(); aura::Desktop::GetInstance()->Run();
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
MessageLoopForUI::current()->Run(host.get());
return 0; return 0;
} }
...@@ -4,21 +4,35 @@ ...@@ -4,21 +4,35 @@
#include "aura/desktop.h" #include "aura/desktop.h"
#include "aura/desktop_host.h"
#include "aura/window.h" #include "aura/window.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/message_loop.h"
#include "ui/gfx/compositor/compositor.h" #include "ui/gfx/compositor/compositor.h"
namespace aura { namespace aura {
Desktop::Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size) // static
: compositor_(ui::Compositor::Create(widget, size)) { Desktop* Desktop::instance_ = NULL;
Desktop::Desktop()
: host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768))) {
compositor_ = ui::Compositor::Create(host_->GetAcceleratedWidget(),
host_->GetSize());
host_->SetDesktop(this);
DCHECK(compositor_.get()); DCHECK(compositor_.get());
window_.reset(new Window(this)); window_.reset(new Window(NULL));
} }
Desktop::~Desktop() { Desktop::~Desktop() {
} }
void Desktop::Run() {
host_->Show();
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
MessageLoopForUI::current()->Run(host_);
}
void Desktop::Draw() { void Desktop::Draw() {
// Second pass renders the layers. // Second pass renders the layers.
compositor_->NotifyStart(); compositor_->NotifyStart();
...@@ -30,4 +44,13 @@ bool Desktop::OnMouseEvent(const MouseEvent& event) { ...@@ -30,4 +44,13 @@ bool Desktop::OnMouseEvent(const MouseEvent& event) {
return window_->OnMouseEvent(event); return window_->OnMouseEvent(event);
} }
// static
Desktop* Desktop::GetInstance() {
if (!instance_) {
instance_ = new Desktop;
instance_->window_->Init();
}
return instance_;
}
} // namespace aura } // namespace aura
...@@ -21,15 +21,19 @@ class Compositor; ...@@ -21,15 +21,19 @@ class Compositor;
namespace aura { namespace aura {
class DesktopHost;
class MouseEvent; class MouseEvent;
class Window; class Window;
// Desktop is responsible for hosting a set of windows. // Desktop is responsible for hosting a set of windows.
class Desktop { class Desktop {
public: public:
Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size); Desktop();
~Desktop(); ~Desktop();
// Shows the desktop host and runs an event loop for it.
void Run();
// Draws the necessary set of windows. // Draws the necessary set of windows.
void Draw(); void Draw();
...@@ -41,11 +45,17 @@ class Desktop { ...@@ -41,11 +45,17 @@ class Desktop {
Window* window() { return window_.get(); } Window* window() { return window_.get(); }
static Desktop* GetInstance();
private: private:
scoped_refptr<ui::Compositor> compositor_; scoped_refptr<ui::Compositor> compositor_;
scoped_ptr<Window> window_; scoped_ptr<Window> window_;
DesktopHost* host_;
static Desktop* instance_;
DISALLOW_COPY_AND_ASSIGN(Desktop); DISALLOW_COPY_AND_ASSIGN(Desktop);
}; };
......
...@@ -9,17 +9,15 @@ ...@@ -9,17 +9,15 @@
#include "aura/desktop.h" #include "aura/desktop.h"
#include "aura/window_delegate.h" #include "aura/window_delegate.h"
#include "base/logging.h" #include "base/logging.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/canvas_skia.h"
#include "ui/gfx/compositor/compositor.h" #include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/layer.h" #include "ui/gfx/compositor/layer.h"
namespace aura { namespace aura {
// TODO: do we need to support child windows? Window::Window(WindowDelegate* delegate)
Window::Window(Desktop* desktop) : delegate_(delegate),
: delegate_(NULL),
visibility_(VISIBILITY_HIDDEN), visibility_(VISIBILITY_HIDDEN),
layer_(new ui::Layer(desktop->compositor())),
needs_paint_all_(true), needs_paint_all_(true),
parent_(NULL), parent_(NULL),
id_(-1) { id_(-1) {
...@@ -28,6 +26,10 @@ Window::Window(Desktop* desktop) ...@@ -28,6 +26,10 @@ Window::Window(Desktop* desktop)
Window::~Window() { Window::~Window() {
} }
void Window::Init() {
layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor()));
}
void Window::SetVisibility(Visibility visibility) { void Window::SetVisibility(Visibility visibility) {
if (visibility_ == visibility) if (visibility_ == visibility)
return; return;
...@@ -51,12 +53,19 @@ void Window::SchedulePaint(const gfx::Rect& bounds) { ...@@ -51,12 +53,19 @@ void Window::SchedulePaint(const gfx::Rect& bounds) {
void Window::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) { void Window::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) {
// TODO: figure out how this is going to work when animating the layer. In // TODO: figure out how this is going to work when animating the layer. In
// particular if we're animating the size then the underyling Texture is going // particular if we're animating the size then the underlying Texture is going
// to be unhappy if we try to set a texture on a size bigger than the size of // to be unhappy if we try to set a texture on a size bigger than the size of
// the texture. // the texture.
layer_->SetCanvas(canvas, origin); layer_->SetCanvas(canvas, origin);
} }
void Window::SetParent(Window* parent) {
if (parent)
parent->AddChild(this);
else
Desktop::GetInstance()->window()->AddChild(this);
}
void Window::DrawTree() { void Window::DrawTree() {
UpdateLayerCanvas(); UpdateLayerCanvas();
Draw(); Draw();
...@@ -96,8 +105,13 @@ void Window::UpdateLayerCanvas() { ...@@ -96,8 +105,13 @@ void Window::UpdateLayerCanvas() {
dirty_rect_.SetRect(0, 0, 0, 0); dirty_rect_.SetRect(0, 0, 0, 0);
if (dirty_rect.IsEmpty()) if (dirty_rect.IsEmpty())
return; return;
if (delegate_) if (delegate_) {
delegate_->OnPaint(dirty_rect); scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvas(
dirty_rect.width(), dirty_rect.height(), false));
canvas->TranslateInt(dirty_rect.x(), dirty_rect.y());
delegate_->OnPaint(canvas.get());
SetCanvas(*canvas->AsCanvasSkia(), bounds().origin());
}
} }
void Window::Draw() { void Window::Draw() {
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
class SkCanvas; class SkCanvas;
...@@ -42,14 +41,17 @@ class Window { ...@@ -42,14 +41,17 @@ class Window {
VISIBILITY_SHOWN_NO_INPUT = 3, VISIBILITY_SHOWN_NO_INPUT = 3,
}; };
explicit Window(Desktop* desktop); explicit Window(WindowDelegate* delegate);
~Window(); ~Window();
void set_delegate(WindowDelegate* d) { delegate_ = d; } void Init();
int id() const { return id_; } int id() const { return id_; }
void set_id(int id) { id_ = id; } void set_id(int id) { id_ = id; }
ui::Layer* layer() { return layer_.get(); }
const ui::Layer* layer() const { return layer_.get(); }
// Changes the visibility of the window. // Changes the visibility of the window.
void SetVisibility(Visibility visibility); void SetVisibility(Visibility visibility);
Visibility visibility() const { return visibility_; } Visibility visibility() const { return visibility_; }
...@@ -64,6 +66,11 @@ class Window { ...@@ -64,6 +66,11 @@ class Window {
// Sets the contents of the window. // Sets the contents of the window.
void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin);
// Sets the parent window of the window. If NULL, the window is parented to
// the desktop's window.
void SetParent(Window* parent);
Window* parent() { return parent_; }
// Draw the window and its children. // Draw the window and its children.
void DrawTree(); void DrawTree();
...@@ -72,7 +79,6 @@ class Window { ...@@ -72,7 +79,6 @@ class Window {
// should change this. // should change this.
void AddChild(Window* child); void AddChild(Window* child);
void RemoveChild(Window* child); void RemoveChild(Window* child);
Window* parent() { return parent_; }
// Handles a mouse event. Returns true if handled. // Handles a mouse event. Returns true if handled.
bool OnMouseEvent(const MouseEvent& event); bool OnMouseEvent(const MouseEvent& event);
......
...@@ -6,14 +6,17 @@ ...@@ -6,14 +6,17 @@
#define AURA_WINDOW_DELEGATE_H_ #define AURA_WINDOW_DELEGATE_H_
#pragma once #pragma once
namespace gfx {
class Canvas;
}
namespace aura { namespace aura {
// Delegate interface for aura::Window. // Delegate interface for aura::Window.
class WindowDelegate { class WindowDelegate {
public: public:
// Asks the delegate to paint to the window. The delegate should call back // Asks the delegate to paint window contents into the supplied canvas.
// to the window with SetCanvas. virtual void OnPaint(gfx::Canvas* canvas) = 0;
virtual void OnPaint(const gfx::Rect& bounds) = 0;
protected: protected:
virtual ~WindowDelegate() {} virtual ~WindowDelegate() {}
......
...@@ -366,7 +366,7 @@ Canvas* Canvas::CreateCanvas(int width, int height, bool is_opaque) { ...@@ -366,7 +366,7 @@ Canvas* Canvas::CreateCanvas(int width, int height, bool is_opaque) {
return new CanvasSkia(width, height, is_opaque); return new CanvasSkia(width, height, is_opaque);
} }
#if defined(OS_WIN) #if defined(OS_WIN) && !defined(USE_AURA)
// TODO(beng): move to canvas_win.cc, etc. // TODO(beng): move to canvas_win.cc, etc.
class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint { class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint {
public: public:
...@@ -388,7 +388,7 @@ class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint { ...@@ -388,7 +388,7 @@ class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint {
#endif #endif
CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) {
#if defined(OS_WIN) #if defined(OS_WIN) && !defined(USE_AURA)
return new CanvasPaintWin(view); return new CanvasPaintWin(view);
#else #else
return NULL; return NULL;
......
// 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 "ui/gfx/screen.h"
#include <windows.h>
#include "base/logging.h"
namespace gfx {
// static
gfx::Point Screen::GetCursorScreenPoint() {
#if defined(OS_WIN)
POINT pt;
GetCursorPos(&pt);
return gfx::Point(pt);
#endif
}
// static
gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) {
NOTIMPLEMENTED();
return gfx::Rect();
}
// static
gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) {
NOTIMPLEMENTED();
return gfx::Rect();
}
static gfx::Rect GetMonitorAreaOrWorkAreaNearestPoint(const gfx::Point& point,
bool work_area) {
NOTIMPLEMENTED();
return gfx::Rect();
}
// static
gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
return GetMonitorAreaOrWorkAreaNearestPoint(point, true);
}
// static
gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
return GetMonitorAreaOrWorkAreaNearestPoint(point, false);
}
gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
NOTIMPLEMENTED();
return NULL;
}
} // namespace gfx
...@@ -265,6 +265,7 @@ ...@@ -265,6 +265,7 @@
'gfx/render_text_win.cc', 'gfx/render_text_win.cc',
'gfx/render_text_win.h', 'gfx/render_text_win.h',
'gfx/screen.h', 'gfx/screen.h',
'gfx/screen_aura.cc',
'gfx/screen_gtk.cc', 'gfx/screen_gtk.cc',
'gfx/screen_wayland.cc', 'gfx/screen_wayland.cc',
'gfx/screen_win.cc', 'gfx/screen_win.cc',
...@@ -285,6 +286,11 @@ ...@@ -285,6 +286,11 @@
'gfx/transform.cc', 'gfx/transform.cc',
], ],
'conditions': [ 'conditions': [
['use_aura==1', {
'sources/': [
['exclude', 'gfx/screen_win.cc'],
],
}],
['toolkit_uses_gtk == 1', { ['toolkit_uses_gtk == 1', {
'dependencies': [ 'dependencies': [
# font_gtk.cc uses fontconfig. # font_gtk.cc uses fontconfig.
......
include_rules = [ include_rules = [
"+aura",
"+grit/ui_resources.h", "+grit/ui_resources.h",
"+grit/ui_resources_standard.h", "+grit/ui_resources_standard.h",
"+grit/ui_resources_large.h", "+grit/ui_resources_large.h",
......
// 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 "aura/desktop.h"
#include "aura/desktop_host.h"
#include "aura/window.h"
#include "aura/window_delegate.h"
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "third_party/skia/include/core/SkXfermode.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/rect.h"
#include "views/widget/widget.h"
namespace {
// Trivial WindowDelegate implementation that draws a colored background.
class DemoWindowDelegate : public aura::WindowDelegate {
public:
explicit DemoWindowDelegate(SkColor color) : color_(color) {}
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode);
}
private:
SkColor color_;
DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate);
};
class TestView : public views::View {
public:
TestView() {}
virtual ~TestView() {}
private:
// Overridden from views::View:
virtual void OnPaint(gfx::Canvas* canvas) {
canvas->FillRectInt(SK_ColorYELLOW, 0, 0, width(), height());
}
DISALLOW_COPY_AND_ASSIGN(TestView);
};
} // namespace
int main(int argc, char** argv) {
CommandLine::Init(argc, argv);
// The exit manager is in charge of calling the dtors of singleton objects.
base::AtExitManager exit_manager;
ui::RegisterPathProvider();
icu_util::Initialize();
ResourceBundle::InitSharedInstance("en-US");
#if defined(USE_X11)
base::MessagePumpX::DisableGtkMessagePump();
#endif
aura::Desktop::GetInstance();
// Create a hierarchy of test windows.
DemoWindowDelegate window_delegate1(SK_ColorBLUE);
aura::Window window1(&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);
DemoWindowDelegate window_delegate2(SK_ColorRED);
aura::Window window2(&window_delegate2);
window2.set_id(2);
window2.Init();
window2.SetBounds(gfx::Rect(200, 200, 350, 350), 0);
window2.SetVisibility(aura::Window::VISIBILITY_SHOWN);
window2.SetParent(NULL);
DemoWindowDelegate window_delegate3(SK_ColorGREEN);
aura::Window window3(&window_delegate3);
window3.set_id(3);
window3.Init();
window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0);
window3.SetVisibility(aura::Window::VISIBILITY_SHOWN);
window3.SetParent(&window2);
views::Widget widget;
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
params.bounds = gfx::Rect(75, 75, 80, 80);
params.parent = &window2;
widget.Init(params);
widget.SetContentsView(new TestView);
aura::Desktop::GetInstance()->Run();
return 0;
}
...@@ -1748,7 +1748,12 @@ bool MenuController::SelectByChar(char16 character) { ...@@ -1748,7 +1748,12 @@ bool MenuController::SelectByChar(char16 character) {
return false; return false;
} }
#if defined(OS_WIN) && !defined(USE_AURA) #if defined(OS_WIN)
#if defined(USE_AURA)
void MenuController::RepostEvent(SubmenuView* source,
const MouseEvent& event) {
}
#else
void MenuController::RepostEvent(SubmenuView* source, void MenuController::RepostEvent(SubmenuView* source,
const MouseEvent& event) { const MouseEvent& event) {
if (!state_.item) { if (!state_.item) {
...@@ -1815,7 +1820,8 @@ void MenuController::RepostEvent(SubmenuView* source, ...@@ -1815,7 +1820,8 @@ void MenuController::RepostEvent(SubmenuView* source,
} }
} }
} }
#endif #endif // !defined(USE_AURA)
#endif // defined(OS_WIN)
void MenuController::SetDropMenuItem( void MenuController::SetDropMenuItem(
MenuItemView* new_target, MenuItemView* new_target,
......
// 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 "views/focus/accelerator_handler.h"
namespace views {
AcceleratorHandler::AcceleratorHandler() {
}
bool AcceleratorHandler::Dispatch(const MSG& msg) {
#if defined(OS_WIN)
TranslateMessage(&msg);
DispatchMessage(&msg);
#endif
return true;
}
} // namespace views
// 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 "views/view.h"
namespace views {
gfx::NativeViewAccessible View::GetNativeViewAccessible() {
return NULL;
}
int View::GetHorizontalDragThreshold() {
return 0;
}
int View::GetVerticalDragThreshold() {
return 0;
}
} // namespace views
...@@ -242,6 +242,7 @@ ...@@ -242,6 +242,7 @@
'events/event_utils_win.h', 'events/event_utils_win.h',
'events/event_x.cc', 'events/event_x.cc',
'focus/accelerator_handler.h', 'focus/accelerator_handler.h',
'focus/accelerator_handler_aura.cc',
'focus/accelerator_handler_gtk.cc', 'focus/accelerator_handler_gtk.cc',
'focus/accelerator_handler_touch.cc', 'focus/accelerator_handler_touch.cc',
'focus/accelerator_handler_win.cc', 'focus/accelerator_handler_win.cc',
...@@ -310,6 +311,7 @@ ...@@ -310,6 +311,7 @@
'touchui/touch_selection_controller_impl.h', 'touchui/touch_selection_controller_impl.h',
'view.cc', 'view.cc',
'view.h', 'view.h',
'view_aura.cc',
'view_constants.cc', 'view_constants.cc',
'view_constants.h', 'view_constants.h',
'view_gtk.cc', 'view_gtk.cc',
...@@ -396,6 +398,16 @@ ...@@ -396,6 +398,16 @@
'widget/child_window_message_processor.cc', 'widget/child_window_message_processor.cc',
'widget/child_window_message_processor.h', 'widget/child_window_message_processor.h',
], ],
'conditions': [
['OS=="win"', {
'sources/': [
['include', 'controls/menu/menu_config_win.cc'],
['include', 'controls/menu/menu_item_view_win.cc'],
['include', 'controls/menu/menu_separator_win.cc'],
['include', 'drag_utils_win.cc'],
],
}],
],
}], }],
['toolkit_uses_gtk == 1', { ['toolkit_uses_gtk == 1', {
'dependencies': [ 'dependencies': [
...@@ -766,7 +778,50 @@ ...@@ -766,7 +778,50 @@
}], }],
], ],
}, },
],
'conditions': [
['use_aura==1', {
'targets': [
{
'target_name': 'views_aura_desktop',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icui18n',
'../third_party/icu/icu.gyp:icuuc',
'../ui/ui.gyp:gfx_resources',
'../ui/ui.gyp:ui',
'../ui/ui.gyp:ui_resources',
'../ui/ui.gyp:ui_resources_standard',
'views',
'views_desktop_lib',
],
'include_dirs': [
'..',
],
'sources': [
'aura_desktop/aura_desktop_main.cc',
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc',
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc',
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc',
],
'conditions': [
['OS=="win"', {
'link_settings': {
'libraries': [
'-limm32.lib',
'-loleacc.lib',
]
},
'include_dirs': [
'<(DEPTH)/third_party/wtl/include',
],
}],
],
},
],
}],
], ],
} }
This diff is collapsed.
...@@ -6,11 +6,13 @@ ...@@ -6,11 +6,13 @@
#define VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ #define VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_
#pragma once #pragma once
#include "aura/window_delegate.h"
#include "views/widget/native_widget_private.h" #include "views/widget/native_widget_private.h"
namespace views { namespace views {
class NativeWidgetAura : public internal::NativeWidgetPrivate { class NativeWidgetAura : public internal::NativeWidgetPrivate,
public aura::WindowDelegate {
public: public:
explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate);
virtual ~NativeWidgetAura(); virtual ~NativeWidgetAura();
...@@ -97,7 +99,14 @@ class NativeWidgetAura : public internal::NativeWidgetPrivate { ...@@ -97,7 +99,14 @@ class NativeWidgetAura : public internal::NativeWidgetPrivate {
const Widget* ancestor, gfx::Point* point) const OVERRIDE; const Widget* ancestor, gfx::Point* point) const OVERRIDE;
virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
// Overridden from aura::WindowDelegate:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
private: private:
internal::NativeWidgetDelegate* delegate_;
aura::Window* window_;
DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment