| 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/devtools/devtools_http_handler_impl.h" | 5 #include "content/browser/devtools/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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 331 } |
| 332 | 332 |
| 333 if (info.path.find("/devtools/") != 0) { | 333 if (info.path.find("/devtools/") != 0) { |
| 334 server_->Send404(connection_id); | 334 server_->Send404(connection_id); |
| 335 return; | 335 return; |
| 336 } | 336 } |
| 337 | 337 |
| 338 std::string filename = PathWithoutParams(info.path.substr(10)); | 338 std::string filename = PathWithoutParams(info.path.substr(10)); |
| 339 std::string mime_type = GetMimeType(filename); | 339 std::string mime_type = GetMimeType(filename); |
| 340 | 340 |
| 341 FilePath frontend_dir = delegate_->GetDebugFrontendDir(); | 341 base::FilePath frontend_dir = delegate_->GetDebugFrontendDir(); |
| 342 if (!frontend_dir.empty()) { | 342 if (!frontend_dir.empty()) { |
| 343 FilePath path = frontend_dir.AppendASCII(filename); | 343 base::FilePath path = frontend_dir.AppendASCII(filename); |
| 344 std::string data; | 344 std::string data; |
| 345 file_util::ReadFileToString(path, &data); | 345 file_util::ReadFileToString(path, &data); |
| 346 server_->Send200(connection_id, data, mime_type); | 346 server_->Send200(connection_id, data, mime_type); |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 if (delegate_->BundlesFrontendResources()) { | 349 if (delegate_->BundlesFrontendResources()) { |
| 350 int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); | 350 int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); |
| 351 if (resource_id != -1) { | 351 if (resource_id != -1) { |
| 352 base::StringPiece data = GetContentClient()->GetDataResource( | 352 base::StringPiece data = GetContentClient()->GetDataResource( |
| 353 resource_id, ui::SCALE_FACTOR_NONE); | 353 resource_id, ui::SCALE_FACTOR_NONE); |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 page_info.id.c_str())); | 888 page_info.id.c_str())); |
| 889 std::string devtools_frontend_url = GetFrontendURLInternal( | 889 std::string devtools_frontend_url = GetFrontendURLInternal( |
| 890 page_info.id.c_str(), | 890 page_info.id.c_str(), |
| 891 host); | 891 host); |
| 892 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url); | 892 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url); |
| 893 } | 893 } |
| 894 return dictionary; | 894 return dictionary; |
| 895 } | 895 } |
| 896 | 896 |
| 897 } // namespace content | 897 } // namespace content |
| OLD | NEW |