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

Side by Side Diff: chrome/browser/devtools/devtools_targets_ui.h

Issue 2273063002: DevTools: remove DevToolsTargetDescriptor and its implementations, we are now based on devtools age… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 years, 3 months 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
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 <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/devtools/device/devtools_android_bridge.h" 14 #include "chrome/browser/devtools/device/devtools_android_bridge.h"
15 15
16 namespace base { 16 namespace base {
17 class ListValue; 17 class ListValue;
18 class DictionaryValue; 18 class DictionaryValue;
19 } 19 }
20 20
21 class DevToolsTargetImpl;
22 class Profile; 21 class Profile;
23 22
24 class DevToolsTargetsUIHandler { 23 class DevToolsTargetsUIHandler {
25 public: 24 public:
26 typedef base::Callback<void(const std::string&, 25 typedef base::Callback<void(const std::string&,
27 const base::ListValue&)> Callback; 26 const base::ListValue&)> Callback;
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 std::unique_ptr<DevToolsTargetsUIHandler> CreateForLocal( 34 static std::unique_ptr<DevToolsTargetsUIHandler> CreateForLocal(
36 const Callback& callback); 35 const Callback& callback);
37 36
38 static std::unique_ptr<DevToolsTargetsUIHandler> CreateForAdb( 37 static std::unique_ptr<DevToolsTargetsUIHandler> CreateForAdb(
39 const Callback& callback, 38 const Callback& callback,
40 Profile* profile); 39 Profile* profile);
41 40
42 DevToolsTargetImpl* GetTarget(const std::string& target_id); 41 scoped_refptr<content::DevToolsAgentHost> GetTarget(
42 const std::string& target_id);
43 43
44 virtual void Open(const std::string& browser_id, const std::string& url); 44 virtual void Open(const std::string& browser_id, const std::string& url);
45 45
46 virtual scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( 46 virtual scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost(
47 const std::string& browser_id); 47 const std::string& browser_id);
48 48
49 virtual void ForceUpdate(); 49 virtual void ForceUpdate();
50 50
51 protected: 51 protected:
52 base::DictionaryValue* Serialize(const DevToolsTargetImpl& target); 52 base::DictionaryValue* Serialize(
53 scoped_refptr<content::DevToolsAgentHost> host);
53 void SendSerializedTargets(const base::ListValue& list); 54 void SendSerializedTargets(const base::ListValue& list);
54 55
55 typedef std::map<std::string, DevToolsTargetImpl*> TargetMap; 56 using TargetMap =
57 std::map<std::string, scoped_refptr<content::DevToolsAgentHost>>;
56 TargetMap targets_; 58 TargetMap targets_;
57 59
58 private: 60 private:
59 const std::string source_id_; 61 const std::string source_id_;
60 Callback callback_; 62 Callback callback_;
61 63
62 DISALLOW_COPY_AND_ASSIGN(DevToolsTargetsUIHandler); 64 DISALLOW_COPY_AND_ASSIGN(DevToolsTargetsUIHandler);
63 }; 65 };
64 66
65 class PortForwardingStatusSerializer 67 class PortForwardingStatusSerializer
66 : private DevToolsAndroidBridge::PortForwardingListener { 68 : private DevToolsAndroidBridge::PortForwardingListener {
67 public: 69 public:
68 typedef base::Callback<void(const base::Value&)> Callback; 70 typedef base::Callback<void(const base::Value&)> Callback;
69 71
70 PortForwardingStatusSerializer(const Callback& callback, Profile* profile); 72 PortForwardingStatusSerializer(const Callback& callback, Profile* profile);
71 ~PortForwardingStatusSerializer() override; 73 ~PortForwardingStatusSerializer() override;
72 74
73 void PortStatusChanged(const ForwardingStatus& status) override; 75 void PortStatusChanged(const ForwardingStatus& status) override;
74 76
75 private: 77 private:
76 Callback callback_; 78 Callback callback_;
77 Profile* profile_; 79 Profile* profile_;
78 }; 80 };
79 81
80 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_ 82 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698