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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 net::URLRequest* request; | 222 net::URLRequest* request; |
222 | 223 |
223 if (info.path.find("/devtools/") == 0) { | 224 if (info.path.find("/devtools/") == 0) { |
224 // Serve front-end files from resource bundle. | 225 // Serve front-end files from resource bundle. |
225 std::string filename = PathWithoutParams(info.path.substr(10)); | 226 std::string filename = PathWithoutParams(info.path.substr(10)); |
226 | 227 |
227 if (delegate_->BundlesFrontendResources()) { | 228 if (delegate_->BundlesFrontendResources()) { |
228 int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); | 229 int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); |
229 if (resource_id != -1) { | 230 if (resource_id != -1) { |
230 base::StringPiece data = | 231 base::StringPiece data = |
231 content::GetContentClient()->GetDataResource(resource_id); | 232 content::GetContentClient()->GetDataResource( |
| 233 resource_id, ui::SCALE_FACTOR_NONE); |
232 server_->Send200(connection_id, | 234 server_->Send200(connection_id, |
233 data.as_string(), | 235 data.as_string(), |
234 GetMimeType(filename)); | 236 GetMimeType(filename)); |
235 } | 237 } |
236 return; | 238 return; |
237 } | 239 } |
238 std::string base_url = delegate_->GetFrontendResourcesBaseURL(); | 240 std::string base_url = delegate_->GetFrontendResourcesBaseURL(); |
239 request = new net::URLRequest(GURL(base_url + filename), this); | 241 request = new net::URLRequest(GURL(base_url + filename), this); |
240 } else if (info.path.find("/thumb/") == 0) { | 242 } else if (info.path.find("/thumb/") == 0) { |
241 request = new net::URLRequest(GURL("chrome:/" + info.path), this); | 243 request = new net::URLRequest(GURL("chrome:/" + info.path), this); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 void DevToolsHttpHandlerImpl::AcceptWebSocket( | 615 void DevToolsHttpHandlerImpl::AcceptWebSocket( |
614 int connection_id, | 616 int connection_id, |
615 const net::HttpServerRequestInfo& request) { | 617 const net::HttpServerRequestInfo& request) { |
616 BrowserThread::PostTask( | 618 BrowserThread::PostTask( |
617 BrowserThread::IO, FROM_HERE, | 619 BrowserThread::IO, FROM_HERE, |
618 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), | 620 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), |
619 connection_id, request)); | 621 connection_id, request)); |
620 } | 622 } |
621 | 623 |
622 } // namespace content | 624 } // namespace content |
OLD | NEW |