| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~FetchRequest() {} |
| 73 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 73 virtual 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 virtual std::string GetSource() const override; |
| 135 | 135 |
| 136 virtual void StartDataRequest( | 136 virtual 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 virtual std::string GetMimeType(const std::string& path) const override; |
| 145 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE; | 145 virtual bool ShouldAddContentSecurityPolicy() const override; |
| 146 virtual bool ShouldServeMimeTypeAsContentTypeHeader() const OVERRIDE; | 146 virtual 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( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 public: | 259 public: |
| 260 OpenRemotePageRequest( | 260 OpenRemotePageRequest( |
| 261 Profile* profile, | 261 Profile* profile, |
| 262 const std::string url, | 262 const std::string url, |
| 263 const DevToolsAndroidBridge::RemotePageCallback& callback); | 263 const DevToolsAndroidBridge::RemotePageCallback& callback); |
| 264 virtual ~OpenRemotePageRequest() {} | 264 virtual ~OpenRemotePageRequest() {} |
| 265 | 265 |
| 266 private: | 266 private: |
| 267 // DevToolsAndroidBridge::Listener overrides. | 267 // DevToolsAndroidBridge::Listener overrides. |
| 268 virtual void DeviceListChanged( | 268 virtual void DeviceListChanged( |
| 269 const DevToolsAndroidBridge::RemoteDevices& devices) OVERRIDE; | 269 const DevToolsAndroidBridge::RemoteDevices& devices) override; |
| 270 | 270 |
| 271 bool OpenInBrowser(DevToolsAndroidBridge::RemoteBrowser* browser); | 271 bool OpenInBrowser(DevToolsAndroidBridge::RemoteBrowser* browser); |
| 272 void RemotePageOpened(DevToolsAndroidBridge::RemotePage* page); | 272 void RemotePageOpened(DevToolsAndroidBridge::RemotePage* page); |
| 273 | 273 |
| 274 std::string url_; | 274 std::string url_; |
| 275 DevToolsAndroidBridge::RemotePageCallback callback_; | 275 DevToolsAndroidBridge::RemotePageCallback callback_; |
| 276 bool opening_; | 276 bool opening_; |
| 277 scoped_refptr<DevToolsAndroidBridge> android_bridge_; | 277 scoped_refptr<DevToolsAndroidBridge> android_bridge_; |
| 278 | 278 |
| 279 DISALLOW_COPY_AND_ASSIGN(OpenRemotePageRequest); | 279 DISALLOW_COPY_AND_ASSIGN(OpenRemotePageRequest); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 content::NavigationController& navigation_controller = | 406 content::NavigationController& navigation_controller = |
| 407 web_ui()->GetWebContents()->GetController(); | 407 web_ui()->GetWebContents()->GetController(); |
| 408 content::NavigationController::LoadURLParams params(url); | 408 content::NavigationController::LoadURLParams params(url); |
| 409 params.should_replace_current_entry = true; | 409 params.should_replace_current_entry = true; |
| 410 remote_frontend_loading_url_ = virtual_url; | 410 remote_frontend_loading_url_ = virtual_url; |
| 411 navigation_controller.LoadURLWithParams(params); | 411 navigation_controller.LoadURLWithParams(params); |
| 412 navigation_controller.GetPendingEntry()->SetVirtualURL(virtual_url); | 412 navigation_controller.GetPendingEntry()->SetVirtualURL(virtual_url); |
| 413 | 413 |
| 414 bindings_.AttachTo(page->GetTarget()->GetAgentHost()); | 414 bindings_.AttachTo(page->GetTarget()->GetAgentHost()); |
| 415 } | 415 } |
| OLD | NEW |