diff options
-rw-r--r-- | aura/demo/demo_main.cc | 62 | ||||
-rw-r--r-- | aura/desktop.cc | 29 | ||||
-rw-r--r-- | aura/desktop.h | 12 | ||||
-rw-r--r-- | aura/window.cc | 30 | ||||
-rw-r--r-- | aura/window.h | 14 | ||||
-rw-r--r-- | aura/window_delegate.h | 9 | ||||
-rw-r--r-- | ui/gfx/canvas_skia.cc | 4 | ||||
-rw-r--r-- | ui/gfx/screen_aura.cc | 55 | ||||
-rw-r--r-- | ui/ui.gyp | 6 | ||||
-rw-r--r-- | views/DEPS | 1 | ||||
-rw-r--r-- | views/aura_desktop/aura_desktop_main.cc | 106 | ||||
-rw-r--r-- | views/controls/menu/menu_controller.cc | 10 | ||||
-rw-r--r-- | views/focus/accelerator_handler_aura.cc | 20 | ||||
-rw-r--r-- | views/view_aura.cc | 21 | ||||
-rw-r--r-- | views/views.gyp | 51 | ||||
-rw-r--r-- | views/widget/native_widget_aura.cc | 178 | ||||
-rw-r--r-- | views/widget/native_widget_aura.h | 11 |
17 files changed, 79 insertions, 540 deletions
diff --git a/aura/demo/demo_main.cc b/aura/demo/demo_main.cc index 09cfc29..e8ef169 100644 --- a/aura/demo/demo_main.cc +++ b/aura/demo/demo_main.cc @@ -3,12 +3,14 @@ // 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" @@ -18,21 +20,32 @@ namespace { -// Trivial WindowDelegate implementation that draws a colored background. +// Trivial WindowDelegate implementation that draws a blue background. class DemoWindowDelegate : public aura::WindowDelegate { public: - explicit DemoWindowDelegate(SkColor color) : color_(color) {} + explicit DemoWindowDelegate(aura::Window* window, SkColor color); - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { - canvas->AsCanvasSkia()->drawColor(color_, SkXfermode::kSrc_Mode); - } + virtual void OnPaint(const gfx::Rect& bounds) OVERRIDE; private: + aura::Window* window_; + SkColor color_; 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 @@ -50,34 +63,43 @@ int main(int argc, char** argv) { base::MessagePumpX::DisableGtkMessagePump(); #endif - aura::Desktop::GetInstance(); + // Create the DesktopHost and Desktop. + 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. - DemoWindowDelegate window_delegate1(SK_ColorBLUE); - aura::Window window1(&window_delegate1); + aura::Window window1(&desktop); 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_delegate1(&window1, SK_ColorBLUE); + window1.set_delegate(&window_delegate1); + + desktop.window()->AddChild(&window1); - DemoWindowDelegate window_delegate2(SK_ColorRED); - aura::Window window2(&window_delegate2); + aura::Window window2(&desktop); 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_delegate2(&window2, SK_ColorRED); + window2.set_delegate(&window_delegate2); - DemoWindowDelegate window_delegate3(SK_ColorGREEN); - aura::Window window3(&window_delegate3); + desktop.window()->AddChild(&window2); + + aura::Window window3(&desktop); window3.set_id(3); - window3.Init(); window3.SetBounds(gfx::Rect(10, 10, 50, 50), 0); window3.SetVisibility(aura::Window::VISIBILITY_SHOWN); - window3.SetParent(&window2); + DemoWindowDelegate window_delegate3(&window3, SK_ColorGREEN); + window3.set_delegate(&window_delegate3); + + window2.AddChild(&window3); - aura::Desktop::GetInstance()->Run(); + host->Show(); + + MessageLoop main_message_loop(MessageLoop::TYPE_UI); + MessageLoopForUI::current()->Run(host.get()); return 0; } - diff --git a/aura/desktop.cc b/aura/desktop.cc index f427daf..00b130f 100644 --- a/aura/desktop.cc +++ b/aura/desktop.cc @@ -4,35 +4,21 @@ #include "aura/desktop.h" -#include "aura/desktop_host.h" #include "aura/window.h" #include "base/logging.h" -#include "base/message_loop.h" #include "ui/gfx/compositor/compositor.h" namespace aura { -// static -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); +Desktop::Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size) + : compositor_(ui::Compositor::Create(widget, size)) { DCHECK(compositor_.get()); - window_.reset(new Window(NULL)); + window_.reset(new Window(this)); } Desktop::~Desktop() { } -void Desktop::Run() { - host_->Show(); - MessageLoop main_message_loop(MessageLoop::TYPE_UI); - MessageLoopForUI::current()->Run(host_); -} - void Desktop::Draw() { // Second pass renders the layers. compositor_->NotifyStart(); @@ -44,13 +30,4 @@ bool Desktop::OnMouseEvent(const MouseEvent& event) { return window_->OnMouseEvent(event); } -// static -Desktop* Desktop::GetInstance() { - if (!instance_) { - instance_ = new Desktop; - instance_->window_->Init(); - } - return instance_; -} - } // namespace aura diff --git a/aura/desktop.h b/aura/desktop.h index a894e24..1eb89ca 100644 --- a/aura/desktop.h +++ b/aura/desktop.h @@ -21,19 +21,15 @@ class Compositor; namespace aura { -class DesktopHost; class MouseEvent; class Window; // Desktop is responsible for hosting a set of windows. class Desktop { public: - Desktop(); + Desktop(gfx::AcceleratedWidget widget, const gfx::Size& size); ~Desktop(); - // Shows the desktop host and runs an event loop for it. - void Run(); - // Draws the necessary set of windows. void Draw(); @@ -45,17 +41,11 @@ class Desktop { Window* window() { return window_.get(); } - static Desktop* GetInstance(); - private: scoped_refptr<ui::Compositor> compositor_; scoped_ptr<Window> window_; - DesktopHost* host_; - - static Desktop* instance_; - DISALLOW_COPY_AND_ASSIGN(Desktop); }; diff --git a/aura/window.cc b/aura/window.cc index e6f62a8..11e9b31 100644 --- a/aura/window.cc +++ b/aura/window.cc @@ -9,15 +9,17 @@ #include "aura/desktop.h" #include "aura/window_delegate.h" #include "base/logging.h" -#include "ui/gfx/canvas_skia.h" +#include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/compositor/compositor.h" #include "ui/gfx/compositor/layer.h" namespace aura { -Window::Window(WindowDelegate* delegate) - : delegate_(delegate), +// TODO: do we need to support child windows? +Window::Window(Desktop* desktop) + : delegate_(NULL), visibility_(VISIBILITY_HIDDEN), + layer_(new ui::Layer(desktop->compositor())), needs_paint_all_(true), parent_(NULL), id_(-1) { @@ -26,10 +28,6 @@ Window::Window(WindowDelegate* delegate) Window::~Window() { } -void Window::Init() { - layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor())); -} - void Window::SetVisibility(Visibility visibility) { if (visibility_ == visibility) return; @@ -53,19 +51,12 @@ void Window::SchedulePaint(const gfx::Rect& bounds) { void Window::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) { // TODO: figure out how this is going to work when animating the layer. In - // particular if we're animating the size then the underlying Texture is going + // particular if we're animating the size then the underyling Texture is going // to be unhappy if we try to set a texture on a size bigger than the size of // the texture. layer_->SetCanvas(canvas, origin); } -void Window::SetParent(Window* parent) { - if (parent) - parent->AddChild(this); - else - Desktop::GetInstance()->window()->AddChild(this); -} - void Window::DrawTree() { UpdateLayerCanvas(); Draw(); @@ -105,13 +96,8 @@ void Window::UpdateLayerCanvas() { dirty_rect_.SetRect(0, 0, 0, 0); if (dirty_rect.IsEmpty()) return; - if (delegate_) { - 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()); - } + if (delegate_) + delegate_->OnPaint(dirty_rect); } void Window::Draw() { diff --git a/aura/window.h b/aura/window.h index 871ceb6..f72b2b6 100644 --- a/aura/window.h +++ b/aura/window.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" class SkCanvas; @@ -41,17 +42,14 @@ class Window { VISIBILITY_SHOWN_NO_INPUT = 3, }; - explicit Window(WindowDelegate* delegate); + explicit Window(Desktop* desktop); ~Window(); - void Init(); + void set_delegate(WindowDelegate* d) { delegate_ = d; } int id() const { return 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. void SetVisibility(Visibility visibility); Visibility visibility() const { return visibility_; } @@ -66,11 +64,6 @@ class Window { // Sets the contents of the window. 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. void DrawTree(); @@ -79,6 +72,7 @@ class Window { // should change this. void AddChild(Window* child); void RemoveChild(Window* child); + Window* parent() { return parent_; } // Handles a mouse event. Returns true if handled. bool OnMouseEvent(const MouseEvent& event); diff --git a/aura/window_delegate.h b/aura/window_delegate.h index ffa3191..69637cf 100644 --- a/aura/window_delegate.h +++ b/aura/window_delegate.h @@ -6,17 +6,14 @@ #define AURA_WINDOW_DELEGATE_H_ #pragma once -namespace gfx { -class Canvas; -} - namespace aura { // Delegate interface for aura::Window. class WindowDelegate { public: - // Asks the delegate to paint window contents into the supplied canvas. - virtual void OnPaint(gfx::Canvas* canvas) = 0; + // Asks the delegate to paint to the window. The delegate should call back + // to the window with SetCanvas. + virtual void OnPaint(const gfx::Rect& bounds) = 0; protected: virtual ~WindowDelegate() {} diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc index 9083d1d..160ca94 100644 --- a/ui/gfx/canvas_skia.cc +++ b/ui/gfx/canvas_skia.cc @@ -366,7 +366,7 @@ Canvas* Canvas::CreateCanvas(int width, int height, bool is_opaque) { return new CanvasSkia(width, height, is_opaque); } -#if defined(OS_WIN) && !defined(USE_AURA) +#if defined(OS_WIN) // TODO(beng): move to canvas_win.cc, etc. class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint { public: @@ -388,7 +388,7 @@ class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint { #endif CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { -#if defined(OS_WIN) && !defined(USE_AURA) +#if defined(OS_WIN) return new CanvasPaintWin(view); #else return NULL; diff --git a/ui/gfx/screen_aura.cc b/ui/gfx/screen_aura.cc deleted file mode 100644 index 75b0afc..0000000 --- a/ui/gfx/screen_aura.cc +++ /dev/null @@ -1,55 +0,0 @@ -// 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,7 +265,6 @@ 'gfx/render_text_win.cc', 'gfx/render_text_win.h', 'gfx/screen.h', - 'gfx/screen_aura.cc', 'gfx/screen_gtk.cc', 'gfx/screen_wayland.cc', 'gfx/screen_win.cc', @@ -286,11 +285,6 @@ 'gfx/transform.cc', ], 'conditions': [ - ['use_aura==1', { - 'sources/': [ - ['exclude', 'gfx/screen_win.cc'], - ], - }], ['toolkit_uses_gtk == 1', { 'dependencies': [ # font_gtk.cc uses fontconfig. @@ -1,5 +1,4 @@ include_rules = [ - "+aura", "+grit/ui_resources.h", "+grit/ui_resources_standard.h", "+grit/ui_resources_large.h", diff --git a/views/aura_desktop/aura_desktop_main.cc b/views/aura_desktop/aura_desktop_main.cc deleted file mode 100644 index ce6f3a7..0000000 --- a/views/aura_desktop/aura_desktop_main.cc +++ /dev/null @@ -1,106 +0,0 @@ -// 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; -} - diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 7cfbb3a..a87b9ea 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -1748,12 +1748,7 @@ bool MenuController::SelectByChar(char16 character) { return false; } -#if defined(OS_WIN) -#if defined(USE_AURA) -void MenuController::RepostEvent(SubmenuView* source, - const MouseEvent& event) { -} -#else +#if defined(OS_WIN) && !defined(USE_AURA) void MenuController::RepostEvent(SubmenuView* source, const MouseEvent& event) { if (!state_.item) { @@ -1820,8 +1815,7 @@ void MenuController::RepostEvent(SubmenuView* source, } } } -#endif // !defined(USE_AURA) -#endif // defined(OS_WIN) +#endif void MenuController::SetDropMenuItem( MenuItemView* new_target, diff --git a/views/focus/accelerator_handler_aura.cc b/views/focus/accelerator_handler_aura.cc deleted file mode 100644 index 8f2f31a..0000000 --- a/views/focus/accelerator_handler_aura.cc +++ /dev/null @@ -1,20 +0,0 @@ -// 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 diff --git a/views/view_aura.cc b/views/view_aura.cc deleted file mode 100644 index f01e9b9..0000000 --- a/views/view_aura.cc +++ /dev/null @@ -1,21 +0,0 @@ -// 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 diff --git a/views/views.gyp b/views/views.gyp index 759ee9a..8415705 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -242,7 +242,6 @@ 'events/event_utils_win.h', 'events/event_x.cc', 'focus/accelerator_handler.h', - 'focus/accelerator_handler_aura.cc', 'focus/accelerator_handler_gtk.cc', 'focus/accelerator_handler_touch.cc', 'focus/accelerator_handler_win.cc', @@ -311,7 +310,6 @@ 'touchui/touch_selection_controller_impl.h', 'view.cc', 'view.h', - 'view_aura.cc', 'view_constants.cc', 'view_constants.h', 'view_gtk.cc', @@ -398,16 +396,6 @@ 'widget/child_window_message_processor.cc', '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', { 'dependencies': [ @@ -778,45 +766,6 @@ }], ], }, - { - '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', - ], - }], - ], - }, ], diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc index 8116a0d..38d6d42 100644 --- a/views/widget/native_widget_aura.cc +++ b/views/widget/native_widget_aura.cc @@ -4,20 +4,12 @@ #include "views/widget/native_widget_aura.h" -#include "aura/window.h" -#include "ui/gfx/canvas.h" -#include "ui/gfx/compositor/layer.h" -#include "views/widget/native_widget_delegate.h" - namespace views { //////////////////////////////////////////////////////////////////////////////// // NativeWidgetAura, public: -NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) - : delegate_(delegate), - ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))) { - window_->set_id(1200); +NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) { } NativeWidgetAura::~NativeWidgetAura() { @@ -27,46 +19,36 @@ NativeWidgetAura::~NativeWidgetAura() { // NativeWidgetAura, internal::NativeWidgetPrivate implementation: void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { - window_->Init(); - window_->SetBounds(params.bounds, 0); - window_->SetParent(params.parent); - // TODO(beng): do this some other way. - delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); - window_->SetVisibility(aura::Window::VISIBILITY_SHOWN); } NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { - NOTIMPLEMENTED(); return NULL; } void NativeWidgetAura::UpdateFrameAfterFrameChange() { - NOTIMPLEMENTED(); } bool NativeWidgetAura::ShouldUseNativeFrame() const { - NOTIMPLEMENTED(); return false; } void NativeWidgetAura::FrameTypeChanged() { - NOTIMPLEMENTED(); } Widget* NativeWidgetAura::GetWidget() { - return delegate_->AsWidget(); + return NULL; } const Widget* NativeWidgetAura::GetWidget() const { - return delegate_->AsWidget(); + return NULL; } gfx::NativeView NativeWidgetAura::GetNativeView() const { - return window_; + return NULL; } gfx::NativeWindow NativeWidgetAura::GetNativeWindow() const { - return window_; + return NULL; } Widget* NativeWidgetAura::GetTopLevelWidget() { @@ -75,133 +57,106 @@ Widget* NativeWidgetAura::GetTopLevelWidget() { } const ui::Compositor* NativeWidgetAura::GetCompositor() const { - return window_->layer()->compositor(); + return NULL; } ui::Compositor* NativeWidgetAura::GetCompositor() { - return window_->layer()->compositor(); + return NULL; } void NativeWidgetAura::MarkLayerDirty() { - NOTIMPLEMENTED(); } void NativeWidgetAura::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, View** ancestor) { - NOTIMPLEMENTED(); } void NativeWidgetAura::ViewRemoved(View* view) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetNativeWindowProperty(const char* name, void* value) { - NOTIMPLEMENTED(); } void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { - NOTIMPLEMENTED(); return NULL; } TooltipManager* NativeWidgetAura::GetTooltipManager() const { - NOTIMPLEMENTED(); return NULL; } bool NativeWidgetAura::IsScreenReaderActive() const { - NOTIMPLEMENTED(); return false; } void NativeWidgetAura::SendNativeAccessibilityEvent( View* view, ui::AccessibilityTypes::Event event_type) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetMouseCapture() { - NOTIMPLEMENTED(); } void NativeWidgetAura::ReleaseMouseCapture() { - NOTIMPLEMENTED(); } bool NativeWidgetAura::HasMouseCapture() const { - NOTIMPLEMENTED(); return false; } InputMethod* NativeWidgetAura::CreateInputMethod() { - NOTIMPLEMENTED(); return NULL; } void NativeWidgetAura::CenterWindow(const gfx::Size& size) { - NOTIMPLEMENTED(); } void NativeWidgetAura::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, bool* maximized) const { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetWindowTitle(const std::wstring& title) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetWindowIcons(const SkBitmap& window_icon, const SkBitmap& app_icon) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetAccessibleName(const std::wstring& name) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetAccessibleRole(ui::AccessibilityTypes::Role role) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { - NOTIMPLEMENTED(); } void NativeWidgetAura::BecomeModal() { - NOTIMPLEMENTED(); } gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { - // TODO(beng): ensure screen bounds - return window_->bounds(); + return gfx::Rect(); } gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { - // TODO(beng): - return window_->bounds(); + return gfx::Rect(); } gfx::Rect NativeWidgetAura::GetRestoredBounds() const { - // TODO(beng): - return window_->bounds(); + return gfx::Rect(); } void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { - window_->SetBounds(bounds, 0); } void NativeWidgetAura::SetSize(const gfx::Size& size) { - window_->SetBounds(gfx::Rect(window_->bounds().origin(), size), 0); } void NativeWidgetAura::SetBoundsConstrained(const gfx::Rect& bounds, - Widget* other_widget) { - NOTIMPLEMENTED(); + Widget* other_widget) { } void NativeWidgetAura::MoveAbove(gfx::NativeView native_view) { - NOTIMPLEMENTED(); } void NativeWidgetAura::MoveToTop() { @@ -209,212 +164,105 @@ void NativeWidgetAura::MoveToTop() { } void NativeWidgetAura::SetShape(gfx::NativeRegion region) { - NOTIMPLEMENTED(); } void NativeWidgetAura::Close() { - NOTIMPLEMENTED(); } void NativeWidgetAura::CloseNow() { - NOTIMPLEMENTED(); } void NativeWidgetAura::EnableClose(bool enable) { - NOTIMPLEMENTED(); } void NativeWidgetAura::Show() { - window_->SetVisibility(aura::Window::VISIBILITY_SHOWN); } void NativeWidgetAura::Hide() { - window_->SetVisibility(aura::Window::VISIBILITY_HIDDEN); } void NativeWidgetAura::ShowMaximizedWithBounds( const gfx::Rect& restored_bounds) { - NOTIMPLEMENTED(); } void NativeWidgetAura::ShowWithState(ShowState state) { - NOTIMPLEMENTED(); } bool NativeWidgetAura::IsVisible() const { - return window_->visibility() != aura::Window::VISIBILITY_HIDDEN; + return false; } void NativeWidgetAura::Activate() { - NOTIMPLEMENTED(); } void NativeWidgetAura::Deactivate() { - NOTIMPLEMENTED(); } bool NativeWidgetAura::IsActive() const { - NOTIMPLEMENTED(); return false; } void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { - NOTIMPLEMENTED(); } void NativeWidgetAura::Maximize() { - NOTIMPLEMENTED(); } void NativeWidgetAura::Minimize() { - NOTIMPLEMENTED(); } bool NativeWidgetAura::IsMaximized() const { - NOTIMPLEMENTED(); return false; } bool NativeWidgetAura::IsMinimized() const { - NOTIMPLEMENTED(); return false; } void NativeWidgetAura::Restore() { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetFullscreen(bool fullscreen) { - NOTIMPLEMENTED(); } bool NativeWidgetAura::IsFullscreen() const { - NOTIMPLEMENTED(); return false; } void NativeWidgetAura::SetOpacity(unsigned char opacity) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { - NOTIMPLEMENTED(); } bool NativeWidgetAura::IsAccessibleWidget() const { - NOTIMPLEMENTED(); return false; } void NativeWidgetAura::RunShellDrag(View* view, const ui::OSExchangeData& data, int operation) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) { - NOTIMPLEMENTED(); } void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { - NOTIMPLEMENTED(); } void NativeWidgetAura::ClearNativeFocus() { - NOTIMPLEMENTED(); } void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { - NOTIMPLEMENTED(); } bool NativeWidgetAura::ConvertPointFromAncestor(const Widget* ancestor, gfx::Point* point) const { - NOTIMPLEMENTED(); + NOTREACHED(); return false; } void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { - NOTIMPLEMENTED(); -} - -//////////////////////////////////////////////////////////////////////////////// -// NativeWidgetAura, aura::WindowDelegate implementation: - -void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { - delegate_->OnNativeWidgetPaint(canvas); -} - -//////////////////////////////////////////////////////////////////////////////// -// Widget, public: - -// static -void Widget::NotifyLocaleChanged() { - NOTIMPLEMENTED(); -} - -// static -void Widget::CloseAllSecondaryWidgets() { - NOTIMPLEMENTED(); -} - -bool Widget::ConvertRect(const Widget* source, - const Widget* target, - gfx::Rect* rect) { - return false; -} - - - -namespace internal { - -//////////////////////////////////////////////////////////////////////////////// -// internal::NativeWidgetPrivate, public: - -// static -NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget( - internal::NativeWidgetDelegate* delegate) { - return new NativeWidgetAura(delegate); -} - -// static -NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView( - gfx::NativeView native_view) { - NOTIMPLEMENTED(); - return NULL; -} - -// static -NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow( - gfx::NativeWindow native_window) { - NOTIMPLEMENTED(); - return NULL; -} - -// static -NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget( - gfx::NativeView native_view) { - NOTIMPLEMENTED(); - return NULL; -} - -// static -void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, - Widget::Widgets* children) { - NOTIMPLEMENTED(); -} - -// static -void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, - gfx::NativeView new_parent) { - NOTIMPLEMENTED(); -} - -// static -bool NativeWidgetPrivate::IsMouseButtonDown() { - NOTIMPLEMENTED(); - return false; } -} // namespace internal } // namespace views diff --git a/views/widget/native_widget_aura.h b/views/widget/native_widget_aura.h index ad9af1f..ab3ff9c 100644 --- a/views/widget/native_widget_aura.h +++ b/views/widget/native_widget_aura.h @@ -6,13 +6,11 @@ #define VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ #pragma once -#include "aura/window_delegate.h" #include "views/widget/native_widget_private.h" namespace views { -class NativeWidgetAura : public internal::NativeWidgetPrivate, - public aura::WindowDelegate { +class NativeWidgetAura : public internal::NativeWidgetPrivate { public: explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); virtual ~NativeWidgetAura(); @@ -99,14 +97,7 @@ class NativeWidgetAura : public internal::NativeWidgetPrivate, const Widget* ancestor, gfx::Point* point) const OVERRIDE; virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; - // Overridden from aura::WindowDelegate: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - private: - internal::NativeWidgetDelegate* delegate_; - - aura::Window* window_; - DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); }; |