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 "content/browser/debugger/devtools_http_handler_impl.h" | 5 #include "content/browser/debugger/devtools_http_handler_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "content/public/browser/render_view_host.h" | 31 #include "content/public/browser/render_view_host.h" |
32 #include "content/public/browser/render_widget_host.h" | 32 #include "content/public/browser/render_widget_host.h" |
33 #include "content/public/common/content_client.h" | 33 #include "content/public/common/content_client.h" |
34 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
35 #include "grit/devtools_resources_map.h" | 35 #include "grit/devtools_resources_map.h" |
36 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
37 #include "net/base/io_buffer.h" | 37 #include "net/base/io_buffer.h" |
38 #include "net/server/http_server_request_info.h" | 38 #include "net/server/http_server_request_info.h" |
39 #include "net/url_request/url_request_context.h" | 39 #include "net/url_request/url_request_context.h" |
40 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
| 41 #include "ui/base/layout.h" |
41 | 42 |
42 namespace content { | 43 namespace content { |
43 | 44 |
44 const int kBufferSize = 16 * 1024; | 45 const int kBufferSize = 16 * 1024; |
45 | 46 |
46 namespace { | 47 namespace { |
47 | 48 |
48 class DevToolsDefaultBindingHandler | 49 class DevToolsDefaultBindingHandler |
49 : public DevToolsHttpHandler::RenderViewHostBinding { | 50 : public DevToolsHttpHandler::RenderViewHostBinding { |
50 public: | 51 public: |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 net::URLRequest* request; | 224 net::URLRequest* request; |
224 | 225 |
225 if (info.path.find("/devtools/") == 0) { | 226 if (info.path.find("/devtools/") == 0) { |
226 // Serve front-end files from resource bundle. | 227 // Serve front-end files from resource bundle. |
227 std::string filename = PathWithoutParams(info.path.substr(10)); | 228 std::string filename = PathWithoutParams(info.path.substr(10)); |
228 | 229 |
229 if (delegate_->BundlesFrontendResources()) { | 230 if (delegate_->BundlesFrontendResources()) { |
230 int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); | 231 int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); |
231 if (resource_id != -1) { | 232 if (resource_id != -1) { |
232 base::StringPiece data = | 233 base::StringPiece data = |
233 content::GetContentClient()->GetDataResource(resource_id); | 234 content::GetContentClient()->GetDataResource( |
| 235 resource_id, ui::SCALE_FACTOR_NONE); |
234 server_->Send200(connection_id, | 236 server_->Send200(connection_id, |
235 data.as_string(), | 237 data.as_string(), |
236 GetMimeType(filename)); | 238 GetMimeType(filename)); |
237 } | 239 } |
238 return; | 240 return; |
239 } | 241 } |
240 std::string base_url = delegate_->GetFrontendResourcesBaseURL(); | 242 std::string base_url = delegate_->GetFrontendResourcesBaseURL(); |
241 request = new net::URLRequest(GURL(base_url + filename), this); | 243 request = new net::URLRequest(GURL(base_url + filename), this); |
242 } else if (info.path.find("/thumb/") == 0) { | 244 } else if (info.path.find("/thumb/") == 0) { |
243 request = new net::URLRequest(GURL("chrome:/" + info.path), this); | 245 request = new net::URLRequest(GURL("chrome:/" + info.path), this); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 void DevToolsHttpHandlerImpl::AcceptWebSocket( | 619 void DevToolsHttpHandlerImpl::AcceptWebSocket( |
618 int connection_id, | 620 int connection_id, |
619 const net::HttpServerRequestInfo& request) { | 621 const net::HttpServerRequestInfo& request) { |
620 BrowserThread::PostTask( | 622 BrowserThread::PostTask( |
621 BrowserThread::IO, FROM_HERE, | 623 BrowserThread::IO, FROM_HERE, |
622 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), | 624 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), |
623 connection_id, request)); | 625 connection_id, request)); |
624 } | 626 } |
625 | 627 |
626 } // namespace content | 628 } // namespace content |
OLD | NEW |