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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/devtools/device/devtools_android_bridge.h"
17 class DictionaryValue
;
20 class DevToolsTargetImpl
;
23 class DevToolsTargetsUIHandler
{
25 typedef base::Callback
<void(const std::string
&,
26 const base::ListValue
&)> Callback
;
28 DevToolsTargetsUIHandler(const std::string
& source_id
,
29 const Callback
& callback
);
30 virtual ~DevToolsTargetsUIHandler();
32 std::string
source_id() const { return source_id_
; }
34 static scoped_ptr
<DevToolsTargetsUIHandler
> CreateForLocal(
35 const Callback
& callback
);
37 static scoped_ptr
<DevToolsTargetsUIHandler
> CreateForAdb(
38 const Callback
& callback
, Profile
* profile
);
40 DevToolsTargetImpl
* GetTarget(const std::string
& target_id
);
42 virtual void Open(const std::string
& browser_id
, const std::string
& url
);
44 virtual scoped_refptr
<content::DevToolsAgentHost
> GetBrowserAgentHost(
45 const std::string
& browser_id
);
47 virtual void ForceUpdate();
50 base::DictionaryValue
* Serialize(const DevToolsTargetImpl
& target
);
51 void SendSerializedTargets(const base::ListValue
& list
);
53 typedef std::map
<std::string
, DevToolsTargetImpl
*> TargetMap
;
57 const std::string source_id_
;
60 DISALLOW_COPY_AND_ASSIGN(DevToolsTargetsUIHandler
);
63 class PortForwardingStatusSerializer
64 : private DevToolsAndroidBridge::PortForwardingListener
{
66 typedef base::Callback
<void(const base::Value
&)> Callback
;
68 PortForwardingStatusSerializer(const Callback
& callback
, Profile
* profile
);
69 ~PortForwardingStatusSerializer() override
;
71 void PortStatusChanged(const ForwardingStatus
& status
) override
;
78 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_