OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_WEBUI_INSPECT_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
13 #include "chrome/browser/devtools/devtools_adb_bridge.h" | 13 #include "chrome/browser/devtools/devtools_adb_bridge.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "content/public/browser/web_ui_controller.h" | 16 #include "content/public/browser/web_ui_controller.h" |
17 #include "content/public/browser/web_ui_data_source.h" | 17 #include "content/public/browser/web_ui_data_source.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class Value; | 20 class Value; |
21 } | 21 } |
22 | 22 |
23 class Browser; | 23 class Browser; |
24 class DevToolsTargetImpl; | |
25 | 24 |
26 class InspectUI : public content::WebUIController, | 25 class InspectUI : public content::WebUIController, |
27 public content::NotificationObserver, | 26 public content::NotificationObserver, |
28 public DevToolsAdbBridge::Listener { | 27 public DevToolsAdbBridge::Listener { |
29 public: | 28 public: |
30 explicit InspectUI(content::WebUI* web_ui); | 29 explicit InspectUI(content::WebUI* web_ui); |
31 virtual ~InspectUI(); | 30 virtual ~InspectUI(); |
32 | 31 |
33 void InitUI(); | 32 void InitUI(); |
34 DevToolsTargetImpl* FindTarget(const std::string& type, | 33 void InspectRemotePage(const std::string& page_id); |
35 const std::string& id); | 34 void ActivateRemotePage(const std::string& page_id); |
36 scoped_refptr<DevToolsAdbBridge::RemoteBrowser> FindRemoteBrowser( | 35 void CloseRemotePage(const std::string& page_id); |
37 const std::string& id); | 36 void ReloadRemotePage(const std::string& page_id); |
| 37 void OpenRemotePage(const std::string& browser_id, const std::string& url); |
38 | 38 |
39 static void InspectDevices(Browser* browser); | 39 static void InspectDevices(Browser* browser); |
40 | 40 |
41 private: | 41 private: |
42 class WorkerCreationDestructionListener; | 42 class WorkerCreationDestructionListener; |
43 | 43 |
44 void PopulateWebContentsTargets(); | 44 void PopulateLists(); |
45 void PopulateWorkerTargets(const std::vector<DevToolsTargetImpl*>&); | |
46 | 45 |
47 // content::NotificationObserver overrides. | 46 // content::NotificationObserver overrides. |
48 virtual void Observe(int type, | 47 virtual void Observe(int type, |
49 const content::NotificationSource& source, | 48 const content::NotificationSource& source, |
50 const content::NotificationDetails& details) OVERRIDE; | 49 const content::NotificationDetails& details) OVERRIDE; |
51 | 50 |
52 void StartListeningNotifications(); | 51 void StartListeningNotifications(); |
53 void StopListeningNotifications(); | 52 void StopListeningNotifications(); |
54 | 53 |
55 content::WebUIDataSource* CreateInspectUIHTMLSource(); | 54 content::WebUIDataSource* CreateInspectUIHTMLSource(); |
(...skipping 11 matching lines...) Expand all Loading... |
67 const base::Value* GetPrefValue(const char* name); | 66 const base::Value* GetPrefValue(const char* name); |
68 | 67 |
69 scoped_refptr<WorkerCreationDestructionListener> observer_; | 68 scoped_refptr<WorkerCreationDestructionListener> observer_; |
70 | 69 |
71 // A scoped container for notification registries. | 70 // A scoped container for notification registries. |
72 content::NotificationRegistrar notification_registrar_; | 71 content::NotificationRegistrar notification_registrar_; |
73 | 72 |
74 // A scoped container for preference change registries. | 73 // A scoped container for preference change registries. |
75 PrefChangeRegistrar pref_change_registrar_; | 74 PrefChangeRegistrar pref_change_registrar_; |
76 | 75 |
77 typedef std::map<std::string, DevToolsTargetImpl*> TargetMap; | 76 typedef std::map<std::string, scoped_refptr<DevToolsAdbBridge::RemotePage> > |
78 TargetMap web_contents_targets_; | 77 RemotePages; |
79 TargetMap worker_targets_; | 78 RemotePages remote_pages_; |
80 TargetMap remote_targets_; | |
81 | 79 |
82 typedef std::map<std::string, | 80 typedef std::map<std::string, |
83 scoped_refptr<DevToolsAdbBridge::RemoteBrowser> > RemoteBrowsers; | 81 scoped_refptr<DevToolsAdbBridge::RemoteBrowser> > RemoteBrowsers; |
84 RemoteBrowsers remote_browsers_; | 82 RemoteBrowsers remote_browsers_; |
85 | 83 |
86 DISALLOW_COPY_AND_ASSIGN(InspectUI); | 84 DISALLOW_COPY_AND_ASSIGN(InspectUI); |
87 }; | 85 }; |
88 | 86 |
89 #endif // CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ | 87 #endif // CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ |
OLD | NEW |