summaryrefslogtreecommitdiff
path: root/chromium/ui/views/mus/surface_binding.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/views/mus/surface_binding.cc')
-rw-r--r--chromium/ui/views/mus/surface_binding.cc35
1 files changed, 12 insertions, 23 deletions
diff --git a/chromium/ui/views/mus/surface_binding.cc b/chromium/ui/views/mus/surface_binding.cc
index ed4aedff436..e33e3247bd7 100644
--- a/chromium/ui/views/mus/surface_binding.cc
+++ b/chromium/ui/views/mus/surface_binding.cc
@@ -26,15 +26,10 @@
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/converters/surfaces/surfaces_type_converters.h"
#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/shell/public/cpp/application_impl.h"
-#include "mojo/shell/public/cpp/connect.h"
-#include "mojo/shell/public/interfaces/shell.mojom.h"
+#include "mojo/shell/public/cpp/connector.h"
#include "ui/views/mus/window_tree_host_mus.h"
namespace views {
-namespace {
-void OnGotContentHandlerID(uint32_t content_handler_id) {}
-} // namespace
// PerConnectionState ----------------------------------------------------------
@@ -46,7 +41,7 @@ void OnGotContentHandlerID(uint32_t content_handler_id) {}
class SurfaceBinding::PerConnectionState
: public base::RefCounted<PerConnectionState> {
public:
- static PerConnectionState* Get(mojo::Shell* shell,
+ static PerConnectionState* Get(mojo::Connector* connector,
mus::WindowTreeConnection* connection);
scoped_ptr<cc::OutputSurface> CreateOutputSurface(
@@ -59,7 +54,8 @@ class SurfaceBinding::PerConnectionState
friend class base::RefCounted<PerConnectionState>;
- PerConnectionState(mojo::Shell* shell, mus::WindowTreeConnection* connection);
+ PerConnectionState(mojo::Connector* connector,
+ mus::WindowTreeConnection* connection);
~PerConnectionState();
void Init();
@@ -67,7 +63,7 @@ class SurfaceBinding::PerConnectionState
static base::LazyInstance<
base::ThreadLocalPointer<ConnectionToStateMap>>::Leaky window_states;
- mojo::Shell* shell_;
+ mojo::Connector* connector_;
mus::WindowTreeConnection* connection_;
// Set of state needed to create an OutputSurface.
@@ -83,7 +79,7 @@ base::LazyInstance<base::ThreadLocalPointer<
// static
SurfaceBinding::PerConnectionState* SurfaceBinding::PerConnectionState::Get(
- mojo::Shell* shell,
+ mojo::Connector* connector,
mus::WindowTreeConnection* connection) {
ConnectionToStateMap* window_map = window_states.Pointer()->Get();
if (!window_map) {
@@ -91,7 +87,7 @@ SurfaceBinding::PerConnectionState* SurfaceBinding::PerConnectionState::Get(
window_states.Pointer()->Set(window_map);
}
if (!(*window_map)[connection]) {
- (*window_map)[connection] = new PerConnectionState(shell, connection);
+ (*window_map)[connection] = new PerConnectionState(connector, connection);
(*window_map)[connection]->Init();
}
return (*window_map)[connection];
@@ -113,9 +109,9 @@ SurfaceBinding::PerConnectionState::CreateOutputSurface(
}
SurfaceBinding::PerConnectionState::PerConnectionState(
- mojo::Shell* shell,
+ mojo::Connector* connector,
mus::WindowTreeConnection* connection)
- : shell_(shell), connection_(connection) {}
+ : connector_(connector), connection_(connection) {}
SurfaceBinding::PerConnectionState::~PerConnectionState() {
ConnectionToStateMap* window_map = window_states.Pointer()->Get();
@@ -129,24 +125,17 @@ SurfaceBinding::PerConnectionState::~PerConnectionState() {
}
void SurfaceBinding::PerConnectionState::Init() {
- mojo::ServiceProviderPtr service_provider;
- mojo::URLRequestPtr request(mojo::URLRequest::New());
- request->url = mojo::String::From("mojo:mus");
- shell_->ConnectToApplication(std::move(request), GetProxy(&service_provider),
- nullptr,
- mojo::CreatePermissiveCapabilityFilter(),
- base::Bind(&OnGotContentHandlerID));
- ConnectToService(service_provider.get(), &gpu_);
+ connector_->ConnectToInterface("mojo:mus", &gpu_);
}
// SurfaceBinding --------------------------------------------------------------
-SurfaceBinding::SurfaceBinding(mojo::Shell* shell,
+SurfaceBinding::SurfaceBinding(mojo::Connector* connector,
mus::Window* window,
mus::mojom::SurfaceType surface_type)
: window_(window),
surface_type_(surface_type),
- state_(PerConnectionState::Get(shell, window->connection())) {}
+ state_(PerConnectionState::Get(connector, window->connection())) {}
SurfaceBinding::~SurfaceBinding() {}