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

Side by Side Diff: chrome/browser/search/contextual_search_promo_source_android.cc

Issue 1182183003: Move EndsWith to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/contextual_search_promo_source_android.h" 5 #include "chrome/browser/search/contextual_search_promo_source_android.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 } 84 }
85 85
86 std::string ContextualSearchPromoSourceAndroid::GetSource() const { 86 std::string ContextualSearchPromoSourceAndroid::GetSource() const {
87 return chrome::kChromeUIContextualSearchPromoHost; 87 return chrome::kChromeUIContextualSearchPromoHost;
88 } 88 }
89 89
90 std::string ContextualSearchPromoSourceAndroid::GetMimeType( 90 std::string ContextualSearchPromoSourceAndroid::GetMimeType(
91 const std::string& path_and_query) const { 91 const std::string& path_and_query) const {
92 std::string path(GURL("chrome://host/" + path_and_query).path()); 92 std::string path(GURL("chrome://host/" + path_and_query).path());
93 if (EndsWith(path, ".js", false)) return "application/javascript"; 93 if (base::EndsWith(path, ".js", false)) return "application/javascript";
94 if (EndsWith(path, ".png", false)) return "image/png"; 94 if (base::EndsWith(path, ".png", false)) return "image/png";
95 if (EndsWith(path, ".css", false)) return "text/css"; 95 if (base::EndsWith(path, ".css", false)) return "text/css";
96 if (EndsWith(path, ".html", false)) return "text/html"; 96 if (base::EndsWith(path, ".html", false)) return "text/html";
97 if (EndsWith(path, ".woff", false)) return "font/woff"; 97 if (base::EndsWith(path, ".woff", false)) return "font/woff";
98 if (EndsWith(path, ".woff2", false)) return "font/woff2"; 98 if (base::EndsWith(path, ".woff2", false)) return "font/woff2";
99 return ""; 99 return std::string();
100 } 100 }
101 101
102 bool ContextualSearchPromoSourceAndroid::ShouldDenyXFrameOptions() const { 102 bool ContextualSearchPromoSourceAndroid::ShouldDenyXFrameOptions() const {
103 return false; 103 return false;
104 } 104 }
105 105
106 bool 106 bool
107 ContextualSearchPromoSourceAndroid::ShouldAddContentSecurityPolicy() const { 107 ContextualSearchPromoSourceAndroid::ShouldAddContentSecurityPolicy() const {
108 return false; 108 return false;
109 } 109 }
(...skipping 30 matching lines...) Expand all
140 strings_data.SetString( 140 strings_data.SetString(
141 "optIn", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTIN)); 141 "optIn", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTIN));
142 strings_data.SetString( 142 strings_data.SetString(
143 "optOut", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTOUT)); 143 "optOut", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTOUT));
144 base::StringPiece html( 144 base::StringPiece html(
145 ResourceBundle::GetSharedInstance().GetRawDataResource( 145 ResourceBundle::GetSharedInstance().GetRawDataResource(
146 IDR_CONTEXTUAL_SEARCH_PROMO_HTML)); 146 IDR_CONTEXTUAL_SEARCH_PROMO_HTML));
147 std::string response(webui::GetI18nTemplateHtml(html, &strings_data)); 147 std::string response(webui::GetI18nTemplateHtml(html, &strings_data));
148 callback.Run(base::RefCountedString::TakeString(&response)); 148 callback.Run(base::RefCountedString::TakeString(&response));
149 } 149 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database.cc ('k') | chrome/browser/search/iframe_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698