OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_BINDINGS_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 15 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
16 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" | 16 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" |
17 #include "chrome/browser/devtools/devtools_file_helper.h" | 17 #include "chrome/browser/devtools/devtools_file_helper.h" |
18 #include "chrome/browser/devtools/devtools_file_system_indexer.h" | 18 #include "chrome/browser/devtools/devtools_file_system_indexer.h" |
19 #include "chrome/browser/devtools/devtools_targets_ui.h" | 19 #include "chrome/browser/devtools/devtools_targets_ui.h" |
20 #include "content/public/browser/devtools_agent_host.h" | 20 #include "content/public/browser/devtools_agent_host.h" |
21 #include "content/public/browser/devtools_frontend_host.h" | 21 #include "content/public/browser/devtools_frontend_host.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 24 #include "net/url_request/url_fetcher_delegate.h" |
24 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
25 | 26 |
26 class InfoBarService; | 27 class InfoBarService; |
27 class Profile; | 28 class Profile; |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 struct FileChooserParams; | 31 struct FileChooserParams; |
31 class WebContents; | 32 class WebContents; |
32 } | 33 } |
33 | 34 |
34 // Base implementation of DevTools bindings around front-end. | 35 // Base implementation of DevTools bindings around front-end. |
35 class DevToolsUIBindings : public content::NotificationObserver, | 36 class DevToolsUIBindings : public content::NotificationObserver, |
36 public content::DevToolsFrontendHost::Delegate, | 37 public content::DevToolsFrontendHost::Delegate, |
37 public DevToolsEmbedderMessageDispatcher::Delegate, | 38 public DevToolsEmbedderMessageDispatcher::Delegate, |
38 public DevToolsAndroidBridge::DeviceCountListener, | 39 public DevToolsAndroidBridge::DeviceCountListener, |
39 public content::DevToolsAgentHostClient { | 40 public content::DevToolsAgentHostClient, |
| 41 public net::URLFetcherDelegate { |
40 public: | 42 public: |
41 static DevToolsUIBindings* ForWebContents( | 43 static DevToolsUIBindings* ForWebContents( |
42 content::WebContents* web_contents); | 44 content::WebContents* web_contents); |
43 static GURL ApplyThemeToURL(Profile* profile, const GURL& base_url); | 45 static GURL ApplyThemeToURL(Profile* profile, const GURL& base_url); |
44 | 46 |
45 class Delegate { | 47 class Delegate { |
46 public: | 48 public: |
47 virtual ~Delegate() {} | 49 virtual ~Delegate() {} |
48 virtual void ActivateWindow() = 0; | 50 virtual void ActivateWindow() = 0; |
49 virtual void CloseWindow() = 0; | 51 virtual void CloseWindow() = 0; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 bool replaced_with_another_client) override; | 97 bool replaced_with_another_client) override; |
96 | 98 |
97 // DevToolsEmbedderMessageDispatcher::Delegate implementation. | 99 // DevToolsEmbedderMessageDispatcher::Delegate implementation. |
98 void ActivateWindow(int request_id) override; | 100 void ActivateWindow(int request_id) override; |
99 void CloseWindow(int request_id) override; | 101 void CloseWindow(int request_id) override; |
100 void LoadCompleted(int request_id) override; | 102 void LoadCompleted(int request_id) override; |
101 void SetInspectedPageBounds(int request_id, | 103 void SetInspectedPageBounds(int request_id, |
102 const gfx::Rect& rect) override; | 104 const gfx::Rect& rect) override; |
103 void InspectElementCompleted(int request_id) override; | 105 void InspectElementCompleted(int request_id) override; |
104 void InspectedURLChanged(int request_id, const std::string& url) override; | 106 void InspectedURLChanged(int request_id, const std::string& url) override; |
| 107 void LoadNetworkResource(int request_id, |
| 108 const std::string& url, |
| 109 const std::string& headers, |
| 110 int stream_id) override; |
105 void SetIsDocked(int request_id, bool is_docked) override; | 111 void SetIsDocked(int request_id, bool is_docked) override; |
106 void OpenInNewTab(int request_id, const std::string& url) override; | 112 void OpenInNewTab(int request_id, const std::string& url) override; |
107 void SaveToFile(int request_id, | 113 void SaveToFile(int request_id, |
108 const std::string& url, | 114 const std::string& url, |
109 const std::string& content, | 115 const std::string& content, |
110 bool save_as) override; | 116 bool save_as) override; |
111 void AppendToFile(int request_id, | 117 void AppendToFile(int request_id, |
112 const std::string& url, | 118 const std::string& url, |
113 const std::string& content) override; | 119 const std::string& content) override; |
114 void RequestFileSystems(int request_id) override; | 120 void RequestFileSystems(int request_id) override; |
(...skipping 20 matching lines...) Expand all Loading... |
135 const std::string& browser_id, | 141 const std::string& browser_id, |
136 const std::string& url) override; | 142 const std::string& url) override; |
137 void SetDeviceCountUpdatesEnabled(int request_id, bool enabled) override; | 143 void SetDeviceCountUpdatesEnabled(int request_id, bool enabled) override; |
138 void SetDevicesUpdatesEnabled(int request_id, bool enabled) override; | 144 void SetDevicesUpdatesEnabled(int request_id, bool enabled) override; |
139 void SendMessageToBrowser(int request_id, | 145 void SendMessageToBrowser(int request_id, |
140 const std::string& message) override; | 146 const std::string& message) override; |
141 void RecordActionUMA(int request_id, | 147 void RecordActionUMA(int request_id, |
142 const std::string& name, | 148 const std::string& name, |
143 int action) override; | 149 int action) override; |
144 | 150 |
| 151 // net::URLFetcherDelegate overrides. |
| 152 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 153 |
145 void EnableRemoteDeviceCounter(bool enable); | 154 void EnableRemoteDeviceCounter(bool enable); |
146 | 155 |
147 void SendMessageAck(int request_id); | 156 void SendMessageAck(int request_id, |
| 157 const base::Value* arg1); |
148 | 158 |
149 // DevToolsAndroidBridge::DeviceCountListener override: | 159 // DevToolsAndroidBridge::DeviceCountListener override: |
150 void DeviceCountChanged(int count) override; | 160 void DeviceCountChanged(int count) override; |
151 | 161 |
152 // Forwards discovered devices to frontend. | 162 // Forwards discovered devices to frontend. |
153 virtual void DevicesUpdated(const std::string& source, | 163 virtual void DevicesUpdated(const std::string& source, |
154 const base::ListValue& targets); | 164 const base::ListValue& targets); |
155 | 165 |
156 void DocumentOnLoadCompletedInMainFrame(); | 166 void DocumentOnLoadCompletedInMainFrame(); |
157 void DidNavigateMainFrame(); | 167 void DidNavigateMainFrame(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> > | 209 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> > |
200 IndexingJobsMap; | 210 IndexingJobsMap; |
201 IndexingJobsMap indexing_jobs_; | 211 IndexingJobsMap indexing_jobs_; |
202 | 212 |
203 bool device_count_updates_enabled_; | 213 bool device_count_updates_enabled_; |
204 bool devices_updates_enabled_; | 214 bool devices_updates_enabled_; |
205 bool frontend_loaded_; | 215 bool frontend_loaded_; |
206 scoped_ptr<DevToolsTargetsUIHandler> remote_targets_handler_; | 216 scoped_ptr<DevToolsTargetsUIHandler> remote_targets_handler_; |
207 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; | 217 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; |
208 GURL url_; | 218 GURL url_; |
| 219 using PendingRequestsMap = std::map<const net::URLFetcher*, int>; |
| 220 PendingRequestsMap pending_requests_; |
209 base::WeakPtrFactory<DevToolsUIBindings> weak_factory_; | 221 base::WeakPtrFactory<DevToolsUIBindings> weak_factory_; |
210 | 222 |
211 DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindings); | 223 DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindings); |
212 }; | 224 }; |
213 | 225 |
214 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ | 226 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ |
OLD | NEW |