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/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 int resource_id = | 62 int resource_id = |
63 content::DevToolsHttpHandler::GetFrontendResourceId(filename); | 63 content::DevToolsHttpHandler::GetFrontendResourceId(filename); |
64 | 64 |
65 DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " | 65 DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " |
66 << filename << ". If you compiled with debug_devtools=1, try running" | 66 << filename << ". If you compiled with debug_devtools=1, try running" |
67 " with --debug-devtools."; | 67 " with --debug-devtools."; |
68 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 68 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
69 scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes( | 69 scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes( |
70 resource_id, ui::SCALE_FACTOR_NONE)); | 70 resource_id, ui::SCALE_FACTOR_NONE)); |
71 SendResponse(request_id, bytes); | 71 SendResponse(request_id, bytes.get()); |
72 } | 72 } |
73 | 73 |
74 std::string DevToolsDataSource::GetMimeType(const std::string& path) const { | 74 std::string DevToolsDataSource::GetMimeType(const std::string& path) const { |
75 std::string filename = PathWithoutParams(path); | 75 std::string filename = PathWithoutParams(path); |
76 if (EndsWith(filename, ".html", false)) { | 76 if (EndsWith(filename, ".html", false)) { |
77 return "text/html"; | 77 return "text/html"; |
78 } else if (EndsWith(filename, ".css", false)) { | 78 } else if (EndsWith(filename, ".css", false)) { |
79 return "text/css"; | 79 return "text/css"; |
80 } else if (EndsWith(filename, ".js", false)) { | 80 } else if (EndsWith(filename, ".js", false)) { |
81 return "application/javascript"; | 81 return "application/javascript"; |
(...skipping 20 matching lines...) Expand all Loading... |
102 DevToolsUI::DevToolsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 102 DevToolsUI::DevToolsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
103 DevToolsDataSource* data_source = new DevToolsDataSource(); | 103 DevToolsDataSource* data_source = new DevToolsDataSource(); |
104 Profile* profile = Profile::FromWebUI(web_ui); | 104 Profile* profile = Profile::FromWebUI(web_ui); |
105 ChromeURLDataManager::AddDataSource(profile, data_source); | 105 ChromeURLDataManager::AddDataSource(profile, data_source); |
106 } | 106 } |
107 | 107 |
108 void DevToolsUI::RenderViewCreated( | 108 void DevToolsUI::RenderViewCreated( |
109 content::RenderViewHost* render_view_host) { | 109 content::RenderViewHost* render_view_host) { |
110 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); | 110 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); |
111 } | 111 } |
OLD | NEW |