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