Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: content/common/mojo/mojo_shell_connection_impl.h

Issue 1442893002: Move Shell connection to content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@i2
Patch Set: . Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
6 #define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/common/mojo_shell_connection.h"
11 #include "mojo/application/public/cpp/application_delegate.h"
12
13 namespace mojo {
14 namespace runner {
15 class RunnerConnection;
16 }
17 }
18
19 namespace content {
20
21 // Returns true if the Chrome browser process was launched from the external
22 // Mojo shell.
23 bool IsRunningInMojoShell();
24
25 class MojoShellConnectionImpl : public MojoShellConnection,
26 public mojo::ApplicationDelegate {
27 public:
28 // Creates an instance of this class and stuffs it in TLS on the calling
29 // thread. Retrieve it using MojoShellConnection::Get(). Blocks the calling
30 // thread until calling GetApplication() will return an Initialized()
31 // application with a bound ShellPtr.
32 static void Create();
33
34 private:
35 MojoShellConnectionImpl();
36 ~MojoShellConnectionImpl() override;
37
38 // mojo::ApplicationDelegate:
39 void Initialize(mojo::ApplicationImpl* application) override;
40 bool ConfigureIncomingConnection(
41 mojo::ApplicationConnection* connection) override;
42
43 // MojoShellConnection:
44 mojo::ApplicationImpl* GetApplication() override;
45 void AddListener(Listener* listener) override;
46 void RemoveListener(Listener* listener) override;
47
48 // Blocks the calling thread until a connection to the spawning shell is
49 // established, an Application request from it is bound, and the Initialize()
50 // method on that application is called.
51 void WaitForShell();
52
53 bool initialized_;
54 scoped_ptr<mojo::runner::RunnerConnection> runner_connection_;
55 scoped_ptr<mojo::ApplicationImpl> application_impl_;
56 std::vector<Listener*> listeners_;
57
58 DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl);
59 };
60
61 } // namespace content
62
63 #endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698