OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_SPY_SPY_SERVER_IMPL_H_ | 5 #ifndef MOJO_SPY_SPY_SERVER_IMPL_H_ |
6 #define MOJO_SPY_SPY_SERVER_IMPL_H_ | 6 #define MOJO_SPY_SPY_SERVER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/compiler_specific.h" | |
11 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
12 #include "mojo/public/cpp/system/core.h" | 11 #include "mojo/public/cpp/system/core.h" |
13 #include "mojo/spy/public/spy.mojom.h" | 12 #include "mojo/spy/public/spy.mojom.h" |
14 #include "url/gurl.h" | 13 #include "url/gurl.h" |
15 | 14 |
16 namespace mojo { | 15 namespace mojo { |
17 | 16 |
18 class SpyServerImpl : | 17 class SpyServerImpl : |
19 public base::RefCounted<SpyServerImpl>, | 18 public base::RefCounted<SpyServerImpl>, |
20 public InterfaceImpl<spy_api::SpyServer> { | 19 public InterfaceImpl<spy_api::SpyServer> { |
21 public: | 20 public: |
22 SpyServerImpl(); | 21 SpyServerImpl(); |
23 | 22 |
24 // spy_api::SpyServer implementation. | 23 // spy_api::SpyServer implementation. |
25 virtual void StartSession( | 24 virtual void StartSession( |
26 spy_api::VersionPtr version, | 25 spy_api::VersionPtr version, |
27 const mojo::Callback<void(spy_api::Result, | 26 const mojo::Callback<void(spy_api::Result, |
28 mojo::String)>& callback) OVERRIDE; | 27 mojo::String)>& callback) override; |
29 | 28 |
30 virtual void StopSession( | 29 virtual void StopSession( |
31 const mojo::Callback<void(spy_api::Result)>& callback) OVERRIDE; | 30 const mojo::Callback<void(spy_api::Result)>& callback) override; |
32 | 31 |
33 virtual void TrackConnection( | 32 virtual void TrackConnection( |
34 uint32_t id, | 33 uint32_t id, |
35 spy_api::ConnectionOptions options, | 34 spy_api::ConnectionOptions options, |
36 const mojo::Callback<void(spy_api::Result)>& callback) OVERRIDE; | 35 const mojo::Callback<void(spy_api::Result)>& callback) override; |
37 | 36 |
38 virtual void OnConnectionError() OVERRIDE; | 37 virtual void OnConnectionError() override; |
39 | 38 |
40 // SpyServerImpl own methods. | 39 // SpyServerImpl own methods. |
41 void OnIntercept(const GURL& url); | 40 void OnIntercept(const GURL& url); |
42 | 41 |
43 ScopedMessagePipeHandle ServerPipe(); | 42 ScopedMessagePipeHandle ServerPipe(); |
44 | 43 |
45 private: | 44 private: |
46 friend class base::RefCounted<SpyServerImpl>; | 45 friend class base::RefCounted<SpyServerImpl>; |
47 virtual ~SpyServerImpl(); | 46 virtual ~SpyServerImpl(); |
48 | 47 |
49 // Item models the entities that we track by IDs. | 48 // Item models the entities that we track by IDs. |
50 struct Item; | 49 struct Item; |
51 | 50 |
52 MessagePipe pipe_; | 51 MessagePipe pipe_; |
53 bool has_session_; | 52 bool has_session_; |
54 std::map<uint32_t, Item*> items_; | 53 std::map<uint32_t, Item*> items_; |
55 }; | 54 }; |
56 | 55 |
57 } // namespace mojo | 56 } // namespace mojo |
58 | 57 |
59 #endif // MOJO_SPY_SPY_SERVER_IMPL_H_ | 58 #endif // MOJO_SPY_SPY_SERVER_IMPL_H_ |
OLD | NEW |