OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 13 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class ListValue; | 16 class ListValue; |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 } | 18 } |
19 | 19 |
20 class DevToolsTargetImpl; | 20 class DevToolsTargetImpl; |
21 class Profile; | 21 class Profile; |
22 | 22 |
23 class DevToolsTargetsUIHandler { | 23 class DevToolsTargetsUIHandler { |
24 public: | 24 public: |
25 typedef base::Callback<void(const std::string&, | 25 typedef base::Callback<void(const std::string&, |
26 const base::ListValue&)> Callback; | 26 const base::ListValue&)> Callback; |
27 typedef base::Callback<void(DevToolsTargetImpl*)> TargetCallback; | |
28 | 27 |
29 DevToolsTargetsUIHandler(const std::string& source_id, | 28 DevToolsTargetsUIHandler(const std::string& source_id, |
30 const Callback& callback); | 29 const Callback& callback); |
31 virtual ~DevToolsTargetsUIHandler(); | 30 virtual ~DevToolsTargetsUIHandler(); |
32 | 31 |
33 std::string source_id() const { return source_id_; } | 32 std::string source_id() const { return source_id_; } |
34 | 33 |
35 static scoped_ptr<DevToolsTargetsUIHandler> CreateForLocal( | 34 static scoped_ptr<DevToolsTargetsUIHandler> CreateForLocal( |
36 const Callback& callback); | 35 const Callback& callback); |
37 | 36 |
38 static scoped_ptr<DevToolsTargetsUIHandler> CreateForAdb( | 37 static scoped_ptr<DevToolsTargetsUIHandler> CreateForAdb( |
39 const Callback& callback, Profile* profile); | 38 const Callback& callback, Profile* profile); |
40 | 39 |
41 DevToolsTargetImpl* GetTarget(const std::string& target_id); | 40 DevToolsTargetImpl* GetTarget(const std::string& target_id); |
42 | 41 |
43 virtual void Open(const std::string& browser_id, const std::string& url, | 42 virtual void Open(const std::string& browser_id, const std::string& url); |
44 const TargetCallback& callback); | |
45 | 43 |
46 virtual scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( | 44 virtual scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( |
47 const std::string& browser_id); | 45 const std::string& browser_id); |
48 | 46 |
49 virtual void ForceUpdate(); | 47 virtual void ForceUpdate(); |
50 | 48 |
51 protected: | 49 protected: |
52 base::DictionaryValue* Serialize(const DevToolsTargetImpl& target); | 50 base::DictionaryValue* Serialize(const DevToolsTargetImpl& target); |
53 void SendSerializedTargets(const base::ListValue& list); | 51 void SendSerializedTargets(const base::ListValue& list); |
54 | 52 |
(...skipping 16 matching lines...) Expand all Loading... |
71 ~PortForwardingStatusSerializer() override; | 69 ~PortForwardingStatusSerializer() override; |
72 | 70 |
73 void PortStatusChanged(const ForwardingStatus& status) override; | 71 void PortStatusChanged(const ForwardingStatus& status) override; |
74 | 72 |
75 private: | 73 private: |
76 Callback callback_; | 74 Callback callback_; |
77 Profile* profile_; | 75 Profile* profile_; |
78 }; | 76 }; |
79 | 77 |
80 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_ | 78 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_ |
OLD | NEW |