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. 4 5 #include "content/public/browser/url_data_source.h" 6 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" 11 12 namespace content { 13 Add(BrowserContext * browser_context,URLDataSource * source)14void URLDataSource::Add(BrowserContext* browser_context, 15 URLDataSource* source) { 16 URLDataManager::AddDataSource(browser_context, source); 17 } 18 MessageLoopForRequestPath(const std::string & path) const19base::MessageLoop* URLDataSource::MessageLoopForRequestPath( 20 const std::string& path) const { 21 return BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::UI); 22 } 23 ShouldReplaceExistingSource() const24bool URLDataSource::ShouldReplaceExistingSource() const { 25 return true; 26 } 27 AllowCaching() const28bool URLDataSource::AllowCaching() const { 29 return true; 30 } 31 ShouldAddContentSecurityPolicy() const32bool URLDataSource::ShouldAddContentSecurityPolicy() const { 33 return true; 34 } 35 GetContentSecurityPolicyObjectSrc() const36std::string URLDataSource::GetContentSecurityPolicyObjectSrc() const { 37 return "object-src 'none';"; 38 } 39 GetContentSecurityPolicyFrameSrc() const40std::string URLDataSource::GetContentSecurityPolicyFrameSrc() const { 41 return "frame-src 'none';"; 42 } 43 ShouldDenyXFrameOptions() const44bool URLDataSource::ShouldDenyXFrameOptions() const { 45 return true; 46 } 47 ShouldServiceRequest(const net::URLRequest * request) const48bool URLDataSource::ShouldServiceRequest(const net::URLRequest* request) const { 49 if (request->url().SchemeIs(chrome::kChromeDevToolsScheme) || 50 request->url().SchemeIs(chrome::kChromeUIScheme)) 51 return true; 52 return false; 53 } 54 ShouldServeMimeTypeAsContentTypeHeader() const55bool URLDataSource::ShouldServeMimeTypeAsContentTypeHeader() const { 56 return false; 57 } 58 59 } // namespace content 60