Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_MOJO_APP_CONNECTION_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_MOJO_APP_CONNECTION_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "content/common/content_export.h" | |
| 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h" | |
| 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | |
| 15 #include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h" | |
| 16 | |
| 17 class GURL; | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 // This provides a way for arbitrary browser code to connect to Mojo | |
| 22 // applications through the global Mojo shell. These objects are not thread-safe | |
|
jam
2015/05/27 16:05:36
nit: what does "global mojo shell" mean?
users of
Ken Rockot(use gerrit already)
2015/05/27 19:36:16
Removed the extra details.
| |
| 23 // but they can be constructed and used on any single thread. | |
| 24 class CONTENT_EXPORT MojoAppConnection { | |
| 25 public: | |
| 26 MojoAppConnection() {} | |
| 27 virtual ~MojoAppConnection() {} | |
|
jam
2015/05/27 16:05:36
nit: see content api wiki and other examples in co
Ken Rockot(use gerrit already)
2015/05/27 19:36:16
Done.
| |
| 28 | |
| 29 // Creates a new connection to the application at |url|. This may be called | |
| 30 // from any thread. | |
| 31 static scoped_ptr<MojoAppConnection> Create(const GURL& url); | |
| 32 | |
| 33 // Connects to a service within the application. | |
| 34 template <typename Interface> | |
| 35 void ConnectToService(mojo::InterfacePtr<Interface>* proxy) { | |
| 36 ConnectToService(Interface::Name_, mojo::GetProxy(proxy).PassMessagePipe()); | |
| 37 } | |
| 38 | |
| 39 virtual void ConnectToService(const std::string& service_name, | |
| 40 mojo::ScopedMessagePipeHandle handle) = 0; | |
| 41 | |
| 42 private: | |
| 43 DISALLOW_COPY_AND_ASSIGN(MojoAppConnection); | |
| 44 }; | |
| 45 | |
| 46 } // namespace content | |
| 47 | |
| 48 #endif // CONTENT_PUBLIC_BROWSER_MOJO_APP_CONNECTION_H_ | |
| OLD | NEW |