| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/local_ntp_source.h" | 5 #include "chrome/browser/search/local_ntp_source.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "grit/browser_resources.h" | 14 #include "grit/browser_resources.h" |
| 15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 16 #include "grit/ui_resources.h" | 16 #include "grit/ui_resources.h" |
| 17 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/webui/jstemplate_builder.h" | 20 #include "ui/webui/jstemplate_builder.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Signifies a locally constructed resource, i.e. not from grit/. | 24 // Signifies a locally constructed resource, i.e. not from grit/. |
| 25 const int kLocalResource = -1; | 25 const int kLocalResource = -1; |
| 26 | 26 |
| 27 const char* kTranslatedStringsFilename = "translated-strings.js"; | 27 const char kTranslatedStringsFilename[] = "translated-strings.js"; |
| 28 | 28 |
| 29 const struct Resource{ | 29 const struct Resource{ |
| 30 const char* filename; | 30 const char* filename; |
| 31 int identifier; | 31 int identifier; |
| 32 const char* mime_type; | 32 const char* mime_type; |
| 33 } kResources[] = { | 33 } kResources[] = { |
| 34 { "local-ntp.html", IDR_LOCAL_NTP_HTML, "text/html" }, | 34 { "local-ntp.html", IDR_LOCAL_NTP_HTML, "text/html" }, |
| 35 { "local-ntp.js", IDR_LOCAL_NTP_JS, "application/javascript" }, | 35 { "local-ntp.js", IDR_LOCAL_NTP_JS, "application/javascript" }, |
| 36 { kTranslatedStringsFilename, kLocalResource, "application/javascript" }, | 36 { kTranslatedStringsFilename, kLocalResource, "application/javascript" }, |
| 37 { "local-ntp.css", IDR_LOCAL_NTP_CSS, "text/css" }, | 37 { "local-ntp.css", IDR_LOCAL_NTP_CSS, "text/css" }, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 | 148 |
| 149 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { | 149 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { |
| 150 // Allow embedding of chrome search suggestion host. | 150 // Allow embedding of chrome search suggestion host. |
| 151 return base::StringPrintf("frame-src %s://%s/;", | 151 return base::StringPrintf("frame-src %s://%s/;", |
| 152 chrome::kChromeSearchScheme, | 152 chrome::kChromeSearchScheme, |
| 153 chrome::kChromeSearchSuggestionHost); | 153 chrome::kChromeSearchSuggestionHost); |
| 154 } | 154 } |
| OLD | NEW |