Chromium Code Reviews| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 explicit BundledDataSource() { | 96 explicit BundledDataSource() { |
| 97 } | 97 } |
| 98 | 98 |
| 99 // content::URLDataSource implementation. | 99 // content::URLDataSource implementation. |
| 100 virtual std::string GetSource() OVERRIDE { | 100 virtual std::string GetSource() OVERRIDE { |
| 101 return chrome::kChromeUIDevToolsBundledHost; | 101 return chrome::kChromeUIDevToolsBundledHost; |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void StartDataRequest( | 104 virtual void StartDataRequest( |
| 105 const std::string& path, | 105 const std::string& path, |
| 106 bool is_incognito, | 106 int render_process_id, |
| 107 int render_view_id, | |
| 107 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { | 108 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { |
| 108 std::string filename = PathWithoutParams(path); | 109 std::string filename = PathWithoutParams(path); |
| 109 | 110 |
| 110 int resource_id = | 111 int resource_id = |
| 111 content::DevToolsHttpHandler::GetFrontendResourceId(filename); | 112 content::DevToolsHttpHandler::GetFrontendResourceId(filename); |
| 112 | 113 |
| 113 DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " | 114 DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " |
| 114 << filename << ". If you compiled with debug_devtools=1, try running" | 115 << filename << ". If you compiled with debug_devtools=1, try running" |
| 115 " with --debug-devtools."; | 116 " with --debug-devtools."; |
| 116 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 117 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 138 request_context) : request_context_(request_context) { | 139 request_context) : request_context_(request_context) { |
| 139 } | 140 } |
| 140 | 141 |
| 141 // content::URLDataSource implementation. | 142 // content::URLDataSource implementation. |
| 142 virtual std::string GetSource() OVERRIDE { | 143 virtual std::string GetSource() OVERRIDE { |
| 143 return chrome::kChromeUIDevToolsRemoteHost; | 144 return chrome::kChromeUIDevToolsRemoteHost; |
| 144 } | 145 } |
| 145 | 146 |
| 146 virtual void StartDataRequest( | 147 virtual void StartDataRequest( |
| 147 const std::string& path, | 148 const std::string& path, |
| 148 bool is_incognito, | 149 int render_process_id, |
| 150 int render_view_id, | |
| 149 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { | 151 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { |
| 150 | 152 |
| 151 GURL url = GURL(kRemoteFrontendBase + path); | 153 GURL url = GURL(kRemoteFrontendBase + path); |
| 152 CHECK_EQ(url.host(), kRemoteFrontendDomain); | 154 CHECK_EQ(url.host(), kRemoteFrontendDomain); |
| 153 new FetchRequest(request_context_, url, callback); | 155 new FetchRequest(request_context_, url, callback); |
| 154 } | 156 } |
| 155 | 157 |
| 156 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { | 158 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { |
| 157 return GetMimeTypeForPath(path); | 159 return GetMimeTypeForPath(path); |
| 158 } | 160 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 175 request_context) : request_context_(request_context) { | 177 request_context) : request_context_(request_context) { |
| 176 } | 178 } |
| 177 | 179 |
| 178 // content::URLDataSource implementation. | 180 // content::URLDataSource implementation. |
| 179 virtual std::string GetSource() OVERRIDE { | 181 virtual std::string GetSource() OVERRIDE { |
| 180 return "localhost"; | 182 return "localhost"; |
| 181 } | 183 } |
| 182 | 184 |
| 183 virtual void StartDataRequest( | 185 virtual void StartDataRequest( |
| 184 const std::string& path, | 186 const std::string& path, |
| 185 bool is_incognito, | 187 const content::URLDataSource::ExtraRequestInfo& info, |
|
jam
2013/04/17 00:45:09
nit: you forgot to update this
Jered
2013/04/17 01:03:08
Done.
| |
| 186 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { | 188 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { |
| 187 | 189 |
| 188 GURL url = GURL("http://localhost:9222/" + path); | 190 GURL url = GURL("http://localhost:9222/" + path); |
| 189 new FetchRequest(request_context_, url, callback); | 191 new FetchRequest(request_context_, url, callback); |
| 190 } | 192 } |
| 191 | 193 |
| 192 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { | 194 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { |
| 193 return GetMimeTypeForPath(path); | 195 return GetMimeTypeForPath(path); |
| 194 } | 196 } |
| 195 | 197 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 new BundledDataSource()); | 234 new BundledDataSource()); |
| 233 content::URLDataSource::Add( | 235 content::URLDataSource::Add( |
| 234 profile, | 236 profile, |
| 235 new RemoteDataSource(profile->GetRequestContext())); | 237 new RemoteDataSource(profile->GetRequestContext())); |
| 236 #if defined(DEBUG_DEVTOOLS) | 238 #if defined(DEBUG_DEVTOOLS) |
| 237 content::URLDataSource::Add( | 239 content::URLDataSource::Add( |
| 238 profile, | 240 profile, |
| 239 new LocalhostDataSource(profile->GetRequestContext())); | 241 new LocalhostDataSource(profile->GetRequestContext())); |
| 240 #endif // defined(DEBUG_DEVTOOLS) | 242 #endif // defined(DEBUG_DEVTOOLS) |
| 241 } | 243 } |
| OLD | NEW |