Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/ui/webui/devtools_ui.cc

Issue 239993009: Revert accidental dartium code push (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/about_version.html ('k') | chrome/browser/ui/webui/version_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (EndsWith(filename, ".html", false)) { 88 if (EndsWith(filename, ".html", false)) {
89 return "text/html"; 89 return "text/html";
90 } else if (EndsWith(filename, ".css", false)) { 90 } else if (EndsWith(filename, ".css", false)) {
91 return "text/css"; 91 return "text/css";
92 } else if (EndsWith(filename, ".js", false)) { 92 } else if (EndsWith(filename, ".js", false)) {
93 return "application/javascript"; 93 return "application/javascript";
94 } else if (EndsWith(filename, ".png", false)) { 94 } else if (EndsWith(filename, ".png", false)) {
95 return "image/png"; 95 return "image/png";
96 } else if (EndsWith(filename, ".gif", false)) { 96 } else if (EndsWith(filename, ".gif", false)) {
97 return "image/gif"; 97 return "image/gif";
98 } else if (EndsWith(filename, ".svg", false)) {
99 return "image/svg+xml";
100 } else if (EndsWith(filename, ".ttf", false)) {
101 return "application/octet-stream";
102 } else if (EndsWith(filename, ".woff", false)) {
103 return "application/font-woff";
104 } else if (EndsWith(filename, ".manifest", false)) { 98 } else if (EndsWith(filename, ".manifest", false)) {
105 return "text/cache-manifest"; 99 return "text/cache-manifest";
106 } 100 }
107 NOTREACHED(); 101 NOTREACHED();
108 return "text/plain"; 102 return "text/plain";
109 } 103 }
110 104
111 // An URLDataSource implementation that handles chrome-devtools://devtools/ 105 // An URLDataSource implementation that handles chrome-devtools://devtools/
112 // requests. Three types of requests could be handled based on the URL path: 106 // requests. Three types of requests could be handled based on the URL path:
113 // 1. /bundled/: bundled DevTools frontend is served. 107 // 1. /bundled/: bundled DevTools frontend is served.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 GURL url = GURL(kRemoteFrontendBase + path); 173 GURL url = GURL(kRemoteFrontendBase + path);
180 CHECK_EQ(url.host(), kRemoteFrontendDomain); 174 CHECK_EQ(url.host(), kRemoteFrontendDomain);
181 new FetchRequest(request_context_.get(), url, callback); 175 new FetchRequest(request_context_.get(), url, callback);
182 } 176 }
183 177
184 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { 178 virtual std::string GetMimeType(const std::string& path) const OVERRIDE {
185 return GetMimeTypeForPath(path); 179 return GetMimeTypeForPath(path);
186 } 180 }
187 181
188 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { 182 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE {
189 // Required as the Dart Observatory is bundled as its own iframe hosted on
190 // chrome-devtools.
191 return true;
192 }
193
194 virtual bool ShouldDenyXFrameOptions() const OVERRIDE {
195 // Required as the Dart Observatory is bundled as its own iframe hosted on
196 // chrome-devtools.
197 return false; 183 return false;
198 } 184 }
199 185
200 virtual bool ShouldServeMimeTypeAsContentTypeHeader() const OVERRIDE { 186 virtual bool ShouldServeMimeTypeAsContentTypeHeader() const OVERRIDE {
201 return true; 187 return true;
202 } 188 }
203 189
204 virtual std::string GetContentSecurityPolicyFrameSrc() const OVERRIDE {
205 // The Dart Observatory is bundled as its own iframe.
206 return "frame-src chrome-devtools://devtools/bundled/Observatory/index_devto ols.html;";
207 }
208
209 private: 190 private:
210 virtual ~DevToolsDataSource() {} 191 virtual ~DevToolsDataSource() {}
211 scoped_refptr<net::URLRequestContextGetter> request_context_; 192 scoped_refptr<net::URLRequestContextGetter> request_context_;
212 193
213 DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource); 194 DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource);
214 }; 195 };
215 196
216 } // namespace 197 } // namespace
217 198
218 // static 199 // static
219 GURL DevToolsUI::GetProxyURL(const std::string& frontend_url) { 200 GURL DevToolsUI::GetProxyURL(const std::string& frontend_url) {
220 GURL url(frontend_url); 201 GURL url(frontend_url);
221 if (!url.is_valid() || url.host() != kRemoteFrontendDomain) { 202 if (!url.is_valid() || url.host() != kRemoteFrontendDomain) {
222 return GURL(kFallbackFrontendURL); 203 return GURL(kFallbackFrontendURL);
223 } 204 }
224 return GURL(base::StringPrintf("%s://%s/%s/%s", 205 return GURL(base::StringPrintf("%s://%s/%s/%s",
225 content::kChromeDevToolsScheme, 206 content::kChromeDevToolsScheme,
226 chrome::kChromeUIDevToolsHost, 207 chrome::kChromeUIDevToolsHost,
227 chrome::kChromeUIDevToolsRemotePath, 208 chrome::kChromeUIDevToolsRemotePath,
228 url.path().substr(1).c_str())); 209 url.path().substr(1).c_str()));
229 } 210 }
230 211
231 DevToolsUI::DevToolsUI(content::WebUI* web_ui) : WebUIController(web_ui) { 212 DevToolsUI::DevToolsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
232 web_ui->SetBindings(0); 213 web_ui->SetBindings(0);
233 Profile* profile = Profile::FromWebUI(web_ui); 214 Profile* profile = Profile::FromWebUI(web_ui);
234 content::URLDataSource::Add( 215 content::URLDataSource::Add(
235 profile, 216 profile,
236 new DevToolsDataSource(profile->GetRequestContext())); 217 new DevToolsDataSource(profile->GetRequestContext()));
237 } 218 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/about_version.html ('k') | chrome/browser/ui/webui/version_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698