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 #include "chrome/browser/ui/webui/devtools_ui.h" | 5 #include "chrome/browser/ui/webui/devtools_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // FetchRequest --------------------------------------------------------------- | 63 // FetchRequest --------------------------------------------------------------- |
64 | 64 |
65 class FetchRequest : public net::URLFetcherDelegate { | 65 class FetchRequest : public net::URLFetcherDelegate { |
66 public: | 66 public: |
67 FetchRequest(net::URLRequestContextGetter* request_context, | 67 FetchRequest(net::URLRequestContextGetter* request_context, |
68 const GURL& url, | 68 const GURL& url, |
69 const content::URLDataSource::GotDataCallback& callback); | 69 const content::URLDataSource::GotDataCallback& callback); |
70 | 70 |
71 private: | 71 private: |
72 virtual ~FetchRequest() {} | 72 ~FetchRequest() override {} |
73 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 73 void OnURLFetchComplete(const net::URLFetcher* source) override; |
74 scoped_ptr<net::URLFetcher> fetcher_; | 74 scoped_ptr<net::URLFetcher> fetcher_; |
75 content::URLDataSource::GotDataCallback callback_; | 75 content::URLDataSource::GotDataCallback callback_; |
76 }; | 76 }; |
77 | 77 |
78 FetchRequest::FetchRequest( | 78 FetchRequest::FetchRequest( |
79 net::URLRequestContextGetter* request_context, | 79 net::URLRequestContextGetter* request_context, |
80 const GURL& url, | 80 const GURL& url, |
81 const content::URLDataSource::GotDataCallback& callback) | 81 const content::URLDataSource::GotDataCallback& callback) |
82 : callback_(callback) { | 82 : callback_(callback) { |
83 if (!url.is_valid()) { | 83 if (!url.is_valid()) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // An URLDataSource implementation that handles chrome-devtools://devtools/ | 124 // An URLDataSource implementation that handles chrome-devtools://devtools/ |
125 // requests. Three types of requests could be handled based on the URL path: | 125 // requests. Three types of requests could be handled based on the URL path: |
126 // 1. /bundled/: bundled DevTools frontend is served. | 126 // 1. /bundled/: bundled DevTools frontend is served. |
127 // 2. /remote/: remote DevTools frontend is served from App Engine. | 127 // 2. /remote/: remote DevTools frontend is served from App Engine. |
128 // 3. /remote/open/: query is URL which is opened on remote device. | 128 // 3. /remote/open/: query is URL which is opened on remote device. |
129 class DevToolsDataSource : public content::URLDataSource { | 129 class DevToolsDataSource : public content::URLDataSource { |
130 public: | 130 public: |
131 explicit DevToolsDataSource(net::URLRequestContextGetter* request_context); | 131 explicit DevToolsDataSource(net::URLRequestContextGetter* request_context); |
132 | 132 |
133 // content::URLDataSource implementation. | 133 // content::URLDataSource implementation. |
134 virtual std::string GetSource() const override; | 134 std::string GetSource() const override; |
135 | 135 |
136 virtual void StartDataRequest( | 136 void StartDataRequest( |
137 const std::string& path, | 137 const std::string& path, |
138 int render_process_id, | 138 int render_process_id, |
139 int render_frame_id, | 139 int render_frame_id, |
140 const content::URLDataSource::GotDataCallback& callback) override; | 140 const content::URLDataSource::GotDataCallback& callback) override; |
141 | 141 |
142 private: | 142 private: |
143 // content::URLDataSource overrides. | 143 // content::URLDataSource overrides. |
144 virtual std::string GetMimeType(const std::string& path) const override; | 144 std::string GetMimeType(const std::string& path) const override; |
145 virtual bool ShouldAddContentSecurityPolicy() const override; | 145 bool ShouldAddContentSecurityPolicy() const override; |
146 virtual bool ShouldServeMimeTypeAsContentTypeHeader() const override; | 146 bool ShouldServeMimeTypeAsContentTypeHeader() const override; |
147 | 147 |
148 // Serves bundled DevTools frontend from ResourceBundle. | 148 // Serves bundled DevTools frontend from ResourceBundle. |
149 void StartBundledDataRequest( | 149 void StartBundledDataRequest( |
150 const std::string& path, | 150 const std::string& path, |
151 int render_process_id, | 151 int render_process_id, |
152 int render_frame_id, | 152 int render_frame_id, |
153 const content::URLDataSource::GotDataCallback& callback); | 153 const content::URLDataSource::GotDataCallback& callback); |
154 | 154 |
155 // Serves remote DevTools frontend from hard-coded App Engine domain. | 155 // Serves remote DevTools frontend from hard-coded App Engine domain. |
156 void StartRemoteDataRequest( | 156 void StartRemoteDataRequest( |
157 const std::string& path, | 157 const std::string& path, |
158 int render_process_id, | 158 int render_process_id, |
159 int render_frame_id, | 159 int render_frame_id, |
160 const content::URLDataSource::GotDataCallback& callback); | 160 const content::URLDataSource::GotDataCallback& callback); |
161 | 161 |
162 virtual ~DevToolsDataSource() {} | 162 ~DevToolsDataSource() override {} |
163 scoped_refptr<net::URLRequestContextGetter> request_context_; | 163 scoped_refptr<net::URLRequestContextGetter> request_context_; |
164 | 164 |
165 DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource); | 165 DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource); |
166 }; | 166 }; |
167 | 167 |
168 DevToolsDataSource::DevToolsDataSource( | 168 DevToolsDataSource::DevToolsDataSource( |
169 net::URLRequestContextGetter* request_context) | 169 net::URLRequestContextGetter* request_context) |
170 : request_context_(request_context) { | 170 : request_context_(request_context) { |
171 } | 171 } |
172 | 172 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 // OpenRemotePageRequest ------------------------------------------------------ | 257 // OpenRemotePageRequest ------------------------------------------------------ |
258 | 258 |
259 class OpenRemotePageRequest : public DevToolsAndroidBridge::DeviceListListener { | 259 class OpenRemotePageRequest : public DevToolsAndroidBridge::DeviceListListener { |
260 public: | 260 public: |
261 OpenRemotePageRequest( | 261 OpenRemotePageRequest( |
262 Profile* profile, | 262 Profile* profile, |
263 const std::string url, | 263 const std::string url, |
264 const DevToolsAndroidBridge::RemotePageCallback& callback); | 264 const DevToolsAndroidBridge::RemotePageCallback& callback); |
265 virtual ~OpenRemotePageRequest() {} | 265 ~OpenRemotePageRequest() override {} |
266 | 266 |
267 private: | 267 private: |
268 // DevToolsAndroidBridge::Listener overrides. | 268 // DevToolsAndroidBridge::Listener overrides. |
269 virtual void DeviceListChanged( | 269 void DeviceListChanged( |
270 const DevToolsAndroidBridge::RemoteDevices& devices) override; | 270 const DevToolsAndroidBridge::RemoteDevices& devices) override; |
271 | 271 |
272 bool OpenInBrowser( | 272 bool OpenInBrowser( |
273 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser); | 273 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser); |
274 void RemotePageOpened(scoped_refptr<DevToolsAndroidBridge::RemotePage> page); | 274 void RemotePageOpened(scoped_refptr<DevToolsAndroidBridge::RemotePage> page); |
275 | 275 |
276 std::string url_; | 276 std::string url_; |
277 DevToolsAndroidBridge::RemotePageCallback callback_; | 277 DevToolsAndroidBridge::RemotePageCallback callback_; |
278 bool opening_; | 278 bool opening_; |
279 scoped_refptr<DevToolsAndroidBridge> android_bridge_; | 279 scoped_refptr<DevToolsAndroidBridge> android_bridge_; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 params.should_replace_current_entry = true; | 414 params.should_replace_current_entry = true; |
415 remote_frontend_loading_url_ = virtual_url; | 415 remote_frontend_loading_url_ = virtual_url; |
416 navigation_controller.LoadURLWithParams(params); | 416 navigation_controller.LoadURLWithParams(params); |
417 navigation_controller.GetPendingEntry()->SetVirtualURL(virtual_url); | 417 navigation_controller.GetPendingEntry()->SetVirtualURL(virtual_url); |
418 | 418 |
419 DevToolsAndroidBridge* bridge = | 419 DevToolsAndroidBridge* bridge = |
420 DevToolsAndroidBridge::Factory::GetForProfile(profile); | 420 DevToolsAndroidBridge::Factory::GetForProfile(profile); |
421 scoped_ptr<DevToolsTargetImpl> target(bridge->CreatePageTarget(page)); | 421 scoped_ptr<DevToolsTargetImpl> target(bridge->CreatePageTarget(page)); |
422 bindings_.AttachTo(target->GetAgentHost()); | 422 bindings_.AttachTo(target->GetAgentHost()); |
423 } | 423 } |
OLD | NEW |