diff options
Diffstat (limited to 'mandoline/ui')
-rw-r--r-- | mandoline/ui/aura/surface_binding.cc | 82 | ||||
-rw-r--r-- | mandoline/ui/aura/surface_binding.h | 8 | ||||
-rw-r--r-- | mandoline/ui/aura/window_tree_host_mojo.cc | 2 | ||||
-rw-r--r-- | mandoline/ui/desktop_ui/browser_apptest.cc | 4 | ||||
-rw-r--r-- | mandoline/ui/desktop_ui/browser_window.cc | 10 | ||||
-rw-r--r-- | mandoline/ui/desktop_ui/browser_window.h | 10 | ||||
-rw-r--r-- | mandoline/ui/omnibox/omnibox_impl.cc | 8 | ||||
-rw-r--r-- | mandoline/ui/omnibox/omnibox_impl.h | 8 | ||||
-rw-r--r-- | mandoline/ui/phone_ui/phone_browser_application_delegate.cc | 12 | ||||
-rw-r--r-- | mandoline/ui/phone_ui/phone_browser_application_delegate.h | 8 |
10 files changed, 76 insertions, 76 deletions
diff --git a/mandoline/ui/aura/surface_binding.cc b/mandoline/ui/aura/surface_binding.cc index 0e9864c..c4ef35b 100644 --- a/mandoline/ui/aura/surface_binding.cc +++ b/mandoline/ui/aura/surface_binding.cc @@ -15,7 +15,7 @@ #include "cc/output/software_output_device.h" #include "cc/resources/shared_bitmap_manager.h" #include "components/view_manager/public/cpp/view.h" -#include "components/view_manager/public/cpp/view_manager.h" +#include "components/view_manager/public/cpp/view_tree_connection.h" #include "components/view_manager/public/interfaces/gpu.mojom.h" #include "components/view_manager/public/interfaces/surfaces.mojom.h" #include "mandoline/ui/aura/window_tree_host_mojo.h" @@ -49,7 +49,7 @@ class OutputSurfaceImpl : public cc::OutputSurface { mojo::View* view_; mojo::Surface* surface_; uint32_t id_namespace_; - uint32_t* next_local_id_; // Owned by PerViewManagerState. + uint32_t* next_local_id_; // Owned by PerConnectionState. uint32_t local_id_; gfx::Size surface_size_; @@ -99,30 +99,30 @@ void OutputSurfaceImpl::SwapBuffers(cc::CompositorFrame* frame) { } // namespace -// PerViewManagerState --------------------------------------------------------- +// PerConnectionState ---------------------------------------------------------- // State needed per ViewManager. Provides the real implementation of // CreateOutputSurface. SurfaceBinding obtains a pointer to the -// PerViewManagerState appropriate for the ViewManager. PerViewManagerState is -// stored in a thread local map. When no more refereces to a PerViewManagerState -// remain the PerViewManagerState is deleted and the underlying map cleaned up. -class SurfaceBinding::PerViewManagerState - : public base::RefCounted<PerViewManagerState>, +// PerConnectionState appropriate for the ViewManager. PerConnectionState is +// stored in a thread local map. When no more refereces to a PerConnectionState +// remain the PerConnectionState is deleted and the underlying map cleaned up. +class SurfaceBinding::PerConnectionState + : public base::RefCounted<PerConnectionState>, public mojo::ResourceReturner { public: - static PerViewManagerState* Get(mojo::Shell* shell, - mojo::ViewManager* view_manager); + static PerConnectionState* Get(mojo::Shell* shell, + mojo::ViewTreeConnection* connection); scoped_ptr<cc::OutputSurface> CreateOutputSurface(mojo::View* view); private: - typedef std::map<mojo::ViewManager*, - PerViewManagerState*> ViewManagerToStateMap; + typedef std::map<mojo::ViewTreeConnection*, + PerConnectionState*> ConnectionToStateMap; - friend class base::RefCounted<PerViewManagerState>; + friend class base::RefCounted<PerConnectionState>; - PerViewManagerState(mojo::Shell* shell, mojo::ViewManager* view_manager); - ~PerViewManagerState() override; + PerConnectionState(mojo::Shell* shell, mojo::ViewTreeConnection* connection); + ~PerConnectionState() override; void Init(); @@ -133,10 +133,10 @@ class SurfaceBinding::PerViewManagerState void SetIdNamespace(uint32_t id_namespace); static base::LazyInstance< - base::ThreadLocalPointer<ViewManagerToStateMap>>::Leaky view_states; + base::ThreadLocalPointer<ConnectionToStateMap>>::Leaky view_states; mojo::Shell* shell_; - mojo::ViewManager* view_manager_; + mojo::ViewTreeConnection* connection_; // Set of state needed to create an OutputSurface. mojo::GpuPtr gpu_; @@ -145,32 +145,32 @@ class SurfaceBinding::PerViewManagerState uint32_t id_namespace_; uint32_t next_local_id_; - DISALLOW_COPY_AND_ASSIGN(PerViewManagerState); + DISALLOW_COPY_AND_ASSIGN(PerConnectionState); }; // static base::LazyInstance<base::ThreadLocalPointer< - SurfaceBinding::PerViewManagerState::ViewManagerToStateMap>>::Leaky - SurfaceBinding::PerViewManagerState::view_states; + SurfaceBinding::PerConnectionState::ConnectionToStateMap>>::Leaky + SurfaceBinding::PerConnectionState::view_states; // static -SurfaceBinding::PerViewManagerState* SurfaceBinding::PerViewManagerState::Get( +SurfaceBinding::PerConnectionState* SurfaceBinding::PerConnectionState::Get( mojo::Shell* shell, - mojo::ViewManager* view_manager) { - ViewManagerToStateMap* view_map = view_states.Pointer()->Get(); + mojo::ViewTreeConnection* connection) { + ConnectionToStateMap* view_map = view_states.Pointer()->Get(); if (!view_map) { - view_map = new ViewManagerToStateMap; + view_map = new ConnectionToStateMap; view_states.Pointer()->Set(view_map); } - if (!(*view_map)[view_manager]) { - (*view_map)[view_manager] = new PerViewManagerState(shell, view_manager); - (*view_map)[view_manager]->Init(); + if (!(*view_map)[connection]) { + (*view_map)[connection] = new PerConnectionState(shell, connection); + (*view_map)[connection]->Init(); } - return (*view_map)[view_manager]; + return (*view_map)[connection]; } scoped_ptr<cc::OutputSurface> -SurfaceBinding::PerViewManagerState::CreateOutputSurface(mojo::View* view) { +SurfaceBinding::PerConnectionState::CreateOutputSurface(mojo::View* view) { // TODO(sky): figure out lifetime here. Do I need to worry about the return // value outliving this? mojo::CommandBufferPtr cb; @@ -181,28 +181,28 @@ SurfaceBinding::PerViewManagerState::CreateOutputSurface(mojo::View* view) { view, context_provider, surface_.get(), id_namespace_, &next_local_id_)); } -SurfaceBinding::PerViewManagerState::PerViewManagerState( +SurfaceBinding::PerConnectionState::PerConnectionState( mojo::Shell* shell, - mojo::ViewManager* view_manager) + mojo::ViewTreeConnection* connection) : shell_(shell), - view_manager_(view_manager), + connection_(connection), returner_binding_(this), id_namespace_(0u), next_local_id_(0u) { } -SurfaceBinding::PerViewManagerState::~PerViewManagerState() { - ViewManagerToStateMap* view_map = view_states.Pointer()->Get(); +SurfaceBinding::PerConnectionState::~PerConnectionState() { + ConnectionToStateMap* view_map = view_states.Pointer()->Get(); DCHECK(view_map); - DCHECK_EQ(this, (*view_map)[view_manager_]); - view_map->erase(view_manager_); + DCHECK_EQ(this, (*view_map)[connection_]); + view_map->erase(connection_); if (view_map->empty()) { delete view_map; view_states.Pointer()->Set(nullptr); } } -void SurfaceBinding::PerViewManagerState::Init() { +void SurfaceBinding::PerConnectionState::Init() { DCHECK(!surface_.get()); mojo::ServiceProviderPtr surfaces_service_provider; @@ -214,7 +214,7 @@ void SurfaceBinding::PerViewManagerState::Init() { nullptr); ConnectToService(surfaces_service_provider.get(), &surface_); surface_->GetIdNamespace( - base::Bind(&SurfaceBinding::PerViewManagerState::SetIdNamespace, + base::Bind(&SurfaceBinding::PerConnectionState::SetIdNamespace, base::Unretained(this))); // Block until we receive our id namespace. surface_.WaitForIncomingResponse(); @@ -235,12 +235,12 @@ void SurfaceBinding::PerViewManagerState::Init() { ConnectToService(gpu_service_provider.get(), &gpu_); } -void SurfaceBinding::PerViewManagerState::SetIdNamespace( +void SurfaceBinding::PerConnectionState::SetIdNamespace( uint32_t id_namespace) { id_namespace_ = id_namespace; } -void SurfaceBinding::PerViewManagerState::ReturnResources( +void SurfaceBinding::PerConnectionState::ReturnResources( mojo::Array<mojo::ReturnedResourcePtr> resources) { } @@ -248,7 +248,7 @@ void SurfaceBinding::PerViewManagerState::ReturnResources( SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view) : view_(view), - state_(PerViewManagerState::Get(shell, view->view_manager())) { + state_(PerConnectionState::Get(shell, view->connection())) { } SurfaceBinding::~SurfaceBinding() { diff --git a/mandoline/ui/aura/surface_binding.h b/mandoline/ui/aura/surface_binding.h index 3a1eeaa..f36002d 100644 --- a/mandoline/ui/aura/surface_binding.h +++ b/mandoline/ui/aura/surface_binding.h @@ -22,8 +22,8 @@ namespace mandoline { // SurfaceBinding is responsible for managing the connections necessary to // bind a View to the surfaces service. // Internally SurfaceBinding manages one connection (and related structures) per -// ViewManager. That is, all Views from a particular ViewManager share the same -// connection. +// ViewTreeConnection. That is, all Views from a particular ViewTreeConnection +// share the same connection. class SurfaceBinding { public: SurfaceBinding(mojo::Shell* shell, mojo::View* view); @@ -34,11 +34,11 @@ class SurfaceBinding { scoped_ptr<cc::OutputSurface> CreateOutputSurface(); private: - class PerViewManagerState; + class PerConnectionState; mojo::Shell* shell_; mojo::View* view_; - scoped_refptr<PerViewManagerState> state_; + scoped_refptr<PerConnectionState> state_; DISALLOW_COPY_AND_ASSIGN(SurfaceBinding); }; diff --git a/mandoline/ui/aura/window_tree_host_mojo.cc b/mandoline/ui/aura/window_tree_host_mojo.cc index ea2150b..44283df9 100644 --- a/mandoline/ui/aura/window_tree_host_mojo.cc +++ b/mandoline/ui/aura/window_tree_host_mojo.cc @@ -4,7 +4,7 @@ #include "mandoline/ui/aura/window_tree_host_mojo.h" -#include "components/view_manager/public/cpp/view_manager.h" +#include "components/view_manager/public/cpp/view_tree_connection.h" #include "mandoline/ui/aura/input_method_mandoline.h" #include "mandoline/ui/aura/surface_context_factory.h" #include "mojo/application/public/interfaces/shell.mojom.h" diff --git a/mandoline/ui/desktop_ui/browser_apptest.cc b/mandoline/ui/desktop_ui/browser_apptest.cc index 1f3ba8e..6cc42bc 100644 --- a/mandoline/ui/desktop_ui/browser_apptest.cc +++ b/mandoline/ui/desktop_ui/browser_apptest.cc @@ -141,10 +141,10 @@ TEST_F(BrowserTest, TwoBrowsers) { ASSERT_NE(browser1->root(), browser2->root()); // Deleting the view manager closes the connection. - delete browser1->root()->view_manager(); + delete browser1->root()->connection(); EXPECT_EQ(browser1, WaitForBrowserClosed()); - delete browser2->root()->view_manager(); + delete browser2->root()->connection(); EXPECT_EQ(browser2, WaitForBrowserClosed()); } diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc index b59c513..bad7e43 100644 --- a/mandoline/ui/desktop_ui/browser_window.cc +++ b/mandoline/ui/desktop_ui/browser_window.cc @@ -91,7 +91,7 @@ void BrowserWindow::LoadURL(const GURL& url) { } //////////////////////////////////////////////////////////////////////////////// -// BrowserWindow, mojo::ViewManagerDelegate implementation: +// BrowserWindow, mojo::ViewTreeDelegate implementation: void BrowserWindow::OnEmbed(mojo::View* root) { // BrowserWindow does not support being embedded more than once. @@ -102,11 +102,11 @@ void BrowserWindow::OnEmbed(mojo::View* root) { // Make it so we get OnWillEmbed() for any Embed()s done by other apps we // Embed(). - root->view_manager()->SetEmbedRoot(); + root->connection()->SetEmbedRoot(); root_ = root; - content_ = root_->view_manager()->CreateView(); + content_ = root_->connection()->CreateView(); Init(root_); view_manager_init_.view_manager_root()->SetViewportSize( @@ -147,7 +147,7 @@ void BrowserWindow::OnEmbed(mojo::View* root) { } } -void BrowserWindow::OnViewManagerDestroyed(mojo::ViewManager* view_manager) { +void BrowserWindow::OnConnectionLost(mojo::ViewTreeConnection* connection) { root_ = nullptr; manager_->BrowserWindowClosed(this); } @@ -250,7 +250,7 @@ void BrowserWindow::Init(mojo::View* root) { aura_init_.reset(new AuraInit(root, app_->shell())); root_ = root; - omnibox_view_ = root_->view_manager()->CreateView(); + omnibox_view_ = root_->connection()->CreateView(); root_->AddChild(omnibox_view_); views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; diff --git a/mandoline/ui/desktop_ui/browser_window.h b/mandoline/ui/desktop_ui/browser_window.h index 6bcf484..a0fab8f 100644 --- a/mandoline/ui/desktop_ui/browser_window.h +++ b/mandoline/ui/desktop_ui/browser_window.h @@ -5,9 +5,9 @@ #ifndef MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ #define MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ -#include "components/view_manager/public/cpp/view_manager.h" -#include "components/view_manager/public/cpp/view_manager_delegate.h" #include "components/view_manager/public/cpp/view_manager_init.h" +#include "components/view_manager/public/cpp/view_tree_connection.h" +#include "components/view_manager/public/cpp/view_tree_delegate.h" #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" #include "mandoline/tab/public/cpp/web_view.h" #include "mandoline/tab/public/interfaces/web_view.mojom.h" @@ -35,7 +35,7 @@ namespace mandoline { class BrowserManager; class ProgressView; -class BrowserWindow : public mojo::ViewManagerDelegate, +class BrowserWindow : public mojo::ViewTreeDelegate, public mojo::ViewManagerRootClient, public web_view::mojom::WebViewClient, public ViewEmbedder, @@ -49,9 +49,9 @@ class BrowserWindow : public mojo::ViewManagerDelegate, void LoadURL(const GURL& url); private: - // Overridden from mojo::ViewManagerDelegate: + // Overridden from mojo::ViewTreeDelegate: void OnEmbed(mojo::View* root) override; - void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; // Overridden from ViewManagerRootClient: void OnAccelerator(mojo::EventPtr event) override; diff --git a/mandoline/ui/omnibox/omnibox_impl.cc b/mandoline/ui/omnibox/omnibox_impl.cc index 445cd77..0611b70 100644 --- a/mandoline/ui/omnibox/omnibox_impl.cc +++ b/mandoline/ui/omnibox/omnibox_impl.cc @@ -5,7 +5,7 @@ #include "mandoline/ui/omnibox/omnibox_impl.h" #include "base/strings/string16.h" -#include "components/view_manager/public/cpp/view_manager.h" +#include "components/view_manager/public/cpp/view_tree_connection.h" #include "mandoline/ui/aura/aura_init.h" #include "mandoline/ui/aura/native_widget_view_manager.h" #include "mojo/application/public/cpp/application_impl.h" @@ -45,7 +45,7 @@ bool OmniboxImpl::ConfigureOutgoingConnection( } //////////////////////////////////////////////////////////////////////////////// -// OmniboxImpl, mojo::ViewManagerDelegate implementation: +// OmniboxImpl, mojo::ViewTreeDelegate implementation: void OmniboxImpl::OnEmbed(mojo::View* root) { root_ = root; @@ -86,7 +86,7 @@ void OmniboxImpl::OnEmbed(mojo::View* root) { ShowWindow(); } -void OmniboxImpl::OnViewManagerDestroyed(mojo::ViewManager* view_manager) { +void OmniboxImpl::OnConnectionLost(mojo::ViewTreeConnection* connection) { root_ = nullptr; } @@ -137,7 +137,7 @@ void OmniboxImpl::Create(mojo::ApplicationConnection* connection, void OmniboxImpl::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ViewTreeClient> request) { - mojo::ViewManager::Create(this, request.Pass()); + mojo::ViewTreeConnection::Create(this, request.Pass()); } //////////////////////////////////////////////////////////////////////////////// diff --git a/mandoline/ui/omnibox/omnibox_impl.h b/mandoline/ui/omnibox/omnibox_impl.h index ff56a40..ce3f2e9 100644 --- a/mandoline/ui/omnibox/omnibox_impl.h +++ b/mandoline/ui/omnibox/omnibox_impl.h @@ -5,7 +5,7 @@ #ifndef MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_ #define MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_ -#include "components/view_manager/public/cpp/view_manager_delegate.h" +#include "components/view_manager/public/cpp/view_tree_delegate.h" #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" #include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h" #include "mojo/application/public/cpp/application_delegate.h" @@ -23,7 +23,7 @@ namespace mandoline { class AuraInit; class OmniboxImpl : public mojo::ApplicationDelegate, - public mojo::ViewManagerDelegate, + public mojo::ViewTreeDelegate, public views::LayoutManager, public views::TextfieldController, public mojo::InterfaceFactory<Omnibox>, @@ -41,9 +41,9 @@ class OmniboxImpl : public mojo::ApplicationDelegate, bool ConfigureOutgoingConnection( mojo::ApplicationConnection* connection) override; - // Overridden from mojo::ViewManagerDelegate: + // Overridden from mojo::ViewTreeDelegate: void OnEmbed(mojo::View* root) override; - void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; // Overridden from views::LayoutManager: gfx::Size GetPreferredSize(const views::View* view) const override; diff --git a/mandoline/ui/phone_ui/phone_browser_application_delegate.cc b/mandoline/ui/phone_ui/phone_browser_application_delegate.cc index ea748c9..f56f16d 100644 --- a/mandoline/ui/phone_ui/phone_browser_application_delegate.cc +++ b/mandoline/ui/phone_ui/phone_browser_application_delegate.cc @@ -5,8 +5,8 @@ #include "mandoline/ui/phone_ui/phone_browser_application_delegate.h" #include "components/view_manager/public/cpp/view.h" -#include "components/view_manager/public/cpp/view_manager.h" #include "components/view_manager/public/cpp/view_manager_init.h" +#include "components/view_manager/public/cpp/view_tree_connection.h" #include "mojo/application/public/cpp/application_connection.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" @@ -53,11 +53,11 @@ void PhoneBrowserApplicationDelegate::LaunchURL(const mojo::String& url) { } //////////////////////////////////////////////////////////////////////////////// -// PhoneBrowserApplicationDelegate, mojo::ViewManagerDelegate implementation: +// PhoneBrowserApplicationDelegate, mojo::ViewTreeDelegate implementation: void PhoneBrowserApplicationDelegate::OnEmbed(mojo::View* root) { - root->view_manager()->SetEmbedRoot(); - content_ = root->view_manager()->CreateView(); + root->connection()->SetEmbedRoot(); + content_ = root->connection()->CreateView(); root->AddChild(content_); content_->SetBounds(root->bounds()); content_->SetVisible(true); @@ -68,8 +68,8 @@ void PhoneBrowserApplicationDelegate::OnEmbed(mojo::View* root) { LaunchURL("http://www.google.com/"); } -void PhoneBrowserApplicationDelegate::OnViewManagerDestroyed( - mojo::ViewManager* view_manager) { +void PhoneBrowserApplicationDelegate::OnConnectionLost( + mojo::ViewTreeConnection* connection) { } //////////////////////////////////////////////////////////////////////////////// diff --git a/mandoline/ui/phone_ui/phone_browser_application_delegate.h b/mandoline/ui/phone_ui/phone_browser_application_delegate.h index 60018c6..dd49e6d 100644 --- a/mandoline/ui/phone_ui/phone_browser_application_delegate.h +++ b/mandoline/ui/phone_ui/phone_browser_application_delegate.h @@ -7,8 +7,8 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "components/view_manager/public/cpp/view_manager_delegate.h" #include "components/view_manager/public/cpp/view_observer.h" +#include "components/view_manager/public/cpp/view_tree_delegate.h" #include "mandoline/tab/public/cpp/web_view.h" #include "mandoline/tab/public/interfaces/web_view.mojom.h" // TODO(beng): move this file somewhere common. @@ -27,7 +27,7 @@ namespace mandoline { class PhoneBrowserApplicationDelegate : public mojo::ApplicationDelegate, public LaunchHandler, - public mojo::ViewManagerDelegate, + public mojo::ViewTreeDelegate, public mojo::ViewObserver, public web_view::mojom::WebViewClient, public mojo::InterfaceFactory<LaunchHandler> { @@ -44,9 +44,9 @@ class PhoneBrowserApplicationDelegate : // Overridden from LaunchHandler: void LaunchURL(const mojo::String& url) override; - // Overridden from mojo::ViewManagerDelegate: + // Overridden from mojo::ViewTreeDelegate: void OnEmbed(mojo::View* root) override; - void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; // Overridden from mojo::ViewObserver: void OnViewBoundsChanged(mojo::View* view, |