summaryrefslogtreecommitdiffstats
path: root/mojo/aura
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 16:07:54 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 16:07:54 +0000
commit74d9b7a702f19af4840814ba88184aa4935dad3d (patch)
tree0a062cad65d1601e695c8ff5a789f2481a461bae /mojo/aura
parent877dd945749497167a247015ad5775fa325f8fce (diff)
downloadchromium_src-74d9b7a702f19af4840814ba88184aa4935dad3d.zip
chromium_src-74d9b7a702f19af4840814ba88184aa4935dad3d.tar.gz
chromium_src-74d9b7a702f19af4840814ba88184aa4935dad3d.tar.bz2
Moves view_manager files to view_manager directory
The WindowTreeHost and ContextFactory implementations are specific to the view manager and should be moved there. No one else should be using these directly. I'm also nuking launcher as it was temporary and the only other place that was using this code. BUG=365012 TEST=none R=ben@chromium.org Review URL: https://codereview.chromium.org/315223004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275453 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/aura')
-rw-r--r--mojo/aura/context_factory_mojo.cc72
-rw-r--r--mojo/aura/context_factory_mojo.h52
-rw-r--r--mojo/aura/window_tree_host_mojo.cc173
-rw-r--r--mojo/aura/window_tree_host_mojo.h72
4 files changed, 0 insertions, 369 deletions
diff --git a/mojo/aura/context_factory_mojo.cc b/mojo/aura/context_factory_mojo.cc
deleted file mode 100644
index a95cc25..0000000
--- a/mojo/aura/context_factory_mojo.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2014 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 "mojo/aura/context_factory_mojo.h"
-
-#include "cc/output/output_surface.h"
-#include "mojo/aura/window_tree_host_mojo.h"
-#include "mojo/cc/context_provider_mojo.h"
-#include "ui/compositor/reflector.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_surface.h"
-#include "webkit/common/gpu/context_provider_in_process.h"
-#include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h"
-#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
-
-namespace mojo {
-
-ContextFactoryMojo::ContextFactoryMojo(
- ScopedMessagePipeHandle command_buffer_handle)
- : command_buffer_handle_(command_buffer_handle.Pass()) {
-}
-
-ContextFactoryMojo::~ContextFactoryMojo() {
-}
-
-scoped_ptr<cc::OutputSurface> ContextFactoryMojo::CreateOutputSurface(
- ui::Compositor* compositor, bool software_fallback) {
- return make_scoped_ptr(
- new cc::OutputSurface(
- new ContextProviderMojo(command_buffer_handle_.Pass())));
-}
-
-scoped_refptr<ui::Reflector> ContextFactoryMojo::CreateReflector(
- ui::Compositor* mirroed_compositor,
- ui::Layer* mirroring_layer) {
- return NULL;
-}
-
-void ContextFactoryMojo::RemoveReflector(
- scoped_refptr<ui::Reflector> reflector) {
-}
-
-scoped_refptr<cc::ContextProvider>
-ContextFactoryMojo::SharedMainThreadContextProvider() {
- if (!shared_main_thread_contexts_ ||
- shared_main_thread_contexts_->DestroyedOnMainThread()) {
- bool lose_context_when_out_of_memory = false;
- shared_main_thread_contexts_ =
- webkit::gpu::ContextProviderInProcess::CreateOffscreen(
- lose_context_when_out_of_memory);
- if (shared_main_thread_contexts_ &&
- !shared_main_thread_contexts_->BindToCurrentThread())
- shared_main_thread_contexts_ = NULL;
- }
- return shared_main_thread_contexts_;
-}
-
-void ContextFactoryMojo::RemoveCompositor(ui::Compositor* compositor) {
-}
-
-bool ContextFactoryMojo::DoesCreateTestContexts() { return false; }
-
-cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() {
- return NULL;
-}
-
-base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() {
- return NULL;
-}
-
-} // namespace mojo
diff --git a/mojo/aura/context_factory_mojo.h b/mojo/aura/context_factory_mojo.h
deleted file mode 100644
index 3eca794..0000000
--- a/mojo/aura/context_factory_mojo.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2013 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 MOJO_AURA_CONTEXT_FACTORY_MOJO_H_
-#define MOJO_AURA_CONTEXT_FACTORY_MOJO_H_
-
-#include "mojo/public/cpp/system/core.h"
-#include "ui/compositor/compositor.h"
-
-namespace webkit {
-namespace gpu {
-class ContextProviderInProcess;
-}
-}
-
-namespace mojo {
-
-// The default factory that creates in-process contexts.
-class ContextFactoryMojo : public ui::ContextFactory {
- public:
- explicit ContextFactoryMojo(ScopedMessagePipeHandle command_buffer_handle);
- virtual ~ContextFactoryMojo();
-
- // ContextFactory implementation
- virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
- ui::Compositor* compositor, bool software_fallback) OVERRIDE;
-
- virtual scoped_refptr<ui::Reflector> CreateReflector(
- ui::Compositor* compositor,
- ui::Layer* layer) OVERRIDE;
- virtual void RemoveReflector(scoped_refptr<ui::Reflector> reflector) OVERRIDE;
-
- virtual scoped_refptr<cc::ContextProvider>
- SharedMainThreadContextProvider() OVERRIDE;
- virtual void RemoveCompositor(ui::Compositor* compositor) OVERRIDE;
- virtual bool DoesCreateTestContexts() OVERRIDE;
- virtual cc::SharedBitmapManager* GetSharedBitmapManager() OVERRIDE;
- virtual base::MessageLoopProxy* GetCompositorMessageLoop() OVERRIDE;
-
- private:
- scoped_refptr<webkit::gpu::ContextProviderInProcess>
- shared_main_thread_contexts_;
-
- ScopedMessagePipeHandle command_buffer_handle_;
-
- DISALLOW_COPY_AND_ASSIGN(ContextFactoryMojo);
-};
-
-} // namespace mojo
-
-#endif // MOJO_AURA_CONTEXT_FACTORY_MOJO_H_
diff --git a/mojo/aura/window_tree_host_mojo.cc b/mojo/aura/window_tree_host_mojo.cc
deleted file mode 100644
index e944fdb..0000000
--- a/mojo/aura/window_tree_host_mojo.cc
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2013 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 "mojo/aura/window_tree_host_mojo.h"
-
-#include "mojo/aura/context_factory_mojo.h"
-#include "mojo/public/c/gles2/gles2.h"
-#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
-#include "ui/aura/env.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_event_dispatcher.h"
-#include "ui/compositor/compositor.h"
-#include "ui/events/event.h"
-#include "ui/events/event_constants.h"
-#include "ui/gfx/geometry/insets.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mojo {
-
-// static
-mojo::ContextFactoryMojo* WindowTreeHostMojo::context_factory_ = NULL;
-
-////////////////////////////////////////////////////////////////////////////////
-// WindowTreeHostMojo, public:
-
-WindowTreeHostMojo::WindowTreeHostMojo(
- NativeViewportPtr viewport,
- const gfx::Rect& bounds,
- const base::Callback<void()>& compositor_created_callback)
- : native_viewport_(viewport.Pass()),
- compositor_created_callback_(compositor_created_callback),
- bounds_(bounds) {
- native_viewport_.set_client(this);
- native_viewport_->Create(Rect::From(bounds));
-
- MessagePipe pipe;
- native_viewport_->CreateGLES2Context(
- MakeRequest<CommandBuffer>(pipe.handle0.Pass()));
-
- // The ContextFactory must exist before any Compositors are created.
- if (context_factory_) {
- delete context_factory_;
- context_factory_ = NULL;
- }
- context_factory_ = new ContextFactoryMojo(pipe.handle1.Pass());
- aura::Env::GetInstance()->set_context_factory(context_factory_);
- CHECK(context_factory_) << "No GL bindings.";
-}
-
-WindowTreeHostMojo::~WindowTreeHostMojo() {
- DestroyCompositor();
- DestroyDispatcher();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WindowTreeHostMojo, aura::WindowTreeHost implementation:
-
-ui::EventSource* WindowTreeHostMojo::GetEventSource() {
- return this;
-}
-
-gfx::AcceleratedWidget WindowTreeHostMojo::GetAcceleratedWidget() {
- NOTIMPLEMENTED() << "GetAcceleratedWidget";
- return gfx::kNullAcceleratedWidget;
-}
-
-void WindowTreeHostMojo::Show() {
- window()->Show();
- native_viewport_->Show();
-}
-
-void WindowTreeHostMojo::Hide() {
- native_viewport_->Hide();
- window()->Hide();
-}
-
-gfx::Rect WindowTreeHostMojo::GetBounds() const {
- return bounds_;
-}
-
-void WindowTreeHostMojo::SetBounds(const gfx::Rect& bounds) {
- native_viewport_->SetBounds(Rect::From(bounds));
-}
-
-gfx::Point WindowTreeHostMojo::GetLocationOnNativeScreen() const {
- return gfx::Point(0, 0);
-}
-
-void WindowTreeHostMojo::SetCapture() {
- NOTIMPLEMENTED();
-}
-
-void WindowTreeHostMojo::ReleaseCapture() {
- NOTIMPLEMENTED();
-}
-
-void WindowTreeHostMojo::PostNativeEvent(
- const base::NativeEvent& native_event) {
- NOTIMPLEMENTED();
-}
-
-void WindowTreeHostMojo::OnDeviceScaleFactorChanged(float device_scale_factor) {
- NOTIMPLEMENTED();
-}
-
-void WindowTreeHostMojo::SetCursorNative(gfx::NativeCursor cursor) {
- NOTIMPLEMENTED();
-}
-
-void WindowTreeHostMojo::MoveCursorToNative(const gfx::Point& location) {
- NOTIMPLEMENTED();
-}
-
-void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) {
- NOTIMPLEMENTED();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WindowTreeHostMojo, ui::EventSource implementation:
-
-ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() {
- return dispatcher();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WindowTreeHostMojo, NativeViewportClient implementation:
-
-void WindowTreeHostMojo::OnCreated() {
- CreateCompositor(GetAcceleratedWidget());
- compositor_created_callback_.Run();
-}
-
-void WindowTreeHostMojo::OnBoundsChanged(RectPtr bounds) {
- bounds_ = bounds.To<gfx::Rect>();
- window()->SetBounds(gfx::Rect(bounds_.size()));
- OnHostResized(bounds_.size());
-}
-
-void WindowTreeHostMojo::OnDestroyed() {
- base::MessageLoop::current()->Quit();
-}
-
-void WindowTreeHostMojo::OnEvent(EventPtr event,
- const mojo::Callback<void()>& callback) {
- switch (event->action) {
- case ui::ET_MOUSE_PRESSED:
- case ui::ET_MOUSE_DRAGGED:
- case ui::ET_MOUSE_RELEASED:
- case ui::ET_MOUSE_MOVED:
- case ui::ET_MOUSE_ENTERED:
- case ui::ET_MOUSE_EXITED: {
- gfx::Point location(event->location->x, event->location->y);
- ui::MouseEvent ev(static_cast<ui::EventType>(event->action), location,
- location, event->flags, 0);
- SendEventToProcessor(&ev);
- break;
- }
- case ui::ET_KEY_PRESSED:
- case ui::ET_KEY_RELEASED: {
- ui::KeyEvent ev(
- static_cast<ui::EventType>(event->action),
- static_cast<ui::KeyboardCode>(event->key_data->key_code),
- event->flags, event->key_data->is_char);
- SendEventToProcessor(&ev);
- break;
- }
- // TODO(beng): touch, etc.
- }
- callback.Run();
-};
-
-} // namespace mojo
diff --git a/mojo/aura/window_tree_host_mojo.h b/mojo/aura/window_tree_host_mojo.h
deleted file mode 100644
index ed5246d..0000000
--- a/mojo/aura/window_tree_host_mojo.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2013 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 MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_
-#define MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_
-
-#include "base/bind.h"
-#include "mojo/services/native_viewport/native_viewport.mojom.h"
-#include "ui/aura/window_tree_host.h"
-#include "ui/events/event_source.h"
-#include "ui/gfx/rect.h"
-
-namespace ui {
-class ContextFactory;
-}
-
-namespace mojo {
-
-class ContextFactoryMojo;
-
-class WindowTreeHostMojo : public aura::WindowTreeHost,
- public ui::EventSource,
- public NativeViewportClient {
- public:
- WindowTreeHostMojo(NativeViewportPtr viewport,
- const gfx::Rect& bounds,
- const base::Callback<void()>& compositor_created_callback);
- virtual ~WindowTreeHostMojo();
-
- gfx::Rect bounds() const { return bounds_; }
-
- private:
- // WindowTreeHost:
- virtual ui::EventSource* GetEventSource() OVERRIDE;
- virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual gfx::Rect GetBounds() const OVERRIDE;
- virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
- virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
- virtual void SetCapture() OVERRIDE;
- virtual void ReleaseCapture() OVERRIDE;
- virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
- virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
- virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE;
- virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE;
- virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE;
-
- // ui::EventSource:
- virtual ui::EventProcessor* GetEventProcessor() OVERRIDE;
-
- // Overridden from NativeViewportClient:
- virtual void OnCreated() OVERRIDE;
- virtual void OnDestroyed() OVERRIDE;
- virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE;
- virtual void OnEvent(EventPtr event,
- const mojo::Callback<void()>& callback) OVERRIDE;
-
- static ContextFactoryMojo* context_factory_;
-
- NativeViewportPtr native_viewport_;
- base::Callback<void()> compositor_created_callback_;
-
- gfx::Rect bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo);
-};
-
-} // namespace mojo
-
-#endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_