Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / url_data_source.cc
blob0c76c50afd0f41af02359306f6b042c96ceb2831
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/browser/url_data_source.h"
7 #include "content/browser/webui/url_data_manager.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/common/url_constants.h"
10 #include "net/url_request/url_request.h"
12 namespace content {
14 void URLDataSource::Add(BrowserContext* browser_context,
15 URLDataSource* source) {
16 URLDataManager::AddDataSource(browser_context, source);
19 base::MessageLoop* URLDataSource::MessageLoopForRequestPath(
20 const std::string& path) const {
21 return BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::UI);
24 bool URLDataSource::ShouldReplaceExistingSource() const {
25 return true;
28 bool URLDataSource::AllowCaching() const {
29 return true;
32 bool URLDataSource::ShouldAddContentSecurityPolicy() const {
33 return true;
36 std::string URLDataSource::GetContentSecurityPolicyObjectSrc() const {
37 return "object-src 'none';";
40 std::string URLDataSource::GetContentSecurityPolicyFrameSrc() const {
41 return "frame-src 'none';";
44 bool URLDataSource::ShouldDenyXFrameOptions() const {
45 return true;
48 bool URLDataSource::ShouldServiceRequest(const net::URLRequest* request) const {
49 if (request->url().SchemeIs(kChromeDevToolsScheme) ||
50 request->url().SchemeIs(kChromeUIScheme))
51 return true;
52 return false;
55 bool URLDataSource::ShouldServeMimeTypeAsContentTypeHeader() const {
56 return false;
59 std::string URLDataSource::GetAccessControlAllowOriginForOrigin(
60 const std::string& origin) const {
61 return std::string();
64 } // namespace content