Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / devtools / devtools_targets_ui.h
blobbd7ef23aa8d23460728d2f494bb4499989de4a56
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_
8 #include <map>
9 #include <string>
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
14 namespace base {
15 class ListValue;
16 class DictionaryValue;
19 class DevToolsTargetImpl;
20 class Profile;
22 class DevToolsTargetsUIHandler {
23 public:
24 typedef base::Callback<void(const std::string&,
25 scoped_ptr<base::ListValue>)> Callback;
27 DevToolsTargetsUIHandler(const std::string& source_id, Callback callback);
28 virtual ~DevToolsTargetsUIHandler();
30 std::string source_id() const { return source_id_; }
32 static scoped_ptr<DevToolsTargetsUIHandler> CreateForRenderers(
33 Callback callback);
35 static scoped_ptr<DevToolsTargetsUIHandler> CreateForWorkers(
36 Callback callback);
38 void Inspect(const std::string& target_id, Profile* profile);
39 void Activate(const std::string& target_id);
40 void Close(const std::string& target_id);
41 void Reload(const std::string& target_id);
43 protected:
44 base::DictionaryValue* Serialize(const DevToolsTargetImpl& target);
45 void SendSerializedTargets(scoped_ptr<base::ListValue> list);
47 typedef std::map<std::string, DevToolsTargetImpl*> TargetMap;
48 TargetMap targets_;
50 private:
51 const std::string source_id_;
52 Callback callback_;
54 DISALLOW_COPY_AND_ASSIGN(DevToolsTargetsUIHandler);
57 class DevToolsRemoteTargetsUIHandler: public DevToolsTargetsUIHandler {
58 public:
59 DevToolsRemoteTargetsUIHandler(const std::string& source_id,
60 Callback callback);
62 static scoped_ptr<DevToolsRemoteTargetsUIHandler> CreateForAdb(
63 Callback callback, Profile* profile);
65 virtual void Open(const std::string& browser_id, const std::string& url) = 0;
67 private:
68 DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteTargetsUIHandler);
71 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGETS_UI_H_