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/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 { "local-ntp-util.js", IDR_LOCAL_NTP_UTIL_JS, "application/javascript" }, | 54 { "local-ntp-util.js", IDR_LOCAL_NTP_UTIL_JS, "application/javascript" }, |
55 { kConfigDataFilename, kLocalResource, "application/javascript" }, | 55 { kConfigDataFilename, kLocalResource, "application/javascript" }, |
56 { "local-ntp.css", IDR_LOCAL_NTP_CSS, "text/css" }, | 56 { "local-ntp.css", IDR_LOCAL_NTP_CSS, "text/css" }, |
57 { "images/close_2.png", IDR_CLOSE_2, "image/png" }, | 57 { "images/close_2.png", IDR_CLOSE_2, "image/png" }, |
58 { "images/close_2_hover.png", IDR_CLOSE_2_H, "image/png" }, | 58 { "images/close_2_hover.png", IDR_CLOSE_2_H, "image/png" }, |
59 { "images/close_2_active.png", IDR_CLOSE_2_P, "image/png" }, | 59 { "images/close_2_active.png", IDR_CLOSE_2_P, "image/png" }, |
60 { "images/close_2_white.png", IDR_CLOSE_2_MASK, "image/png" }, | 60 { "images/close_2_white.png", IDR_CLOSE_2_MASK, "image/png" }, |
61 { "images/google_logo.png", IDR_LOCAL_NTP_IMAGES_LOGO_PNG, "image/png" }, | 61 { "images/google_logo.png", IDR_LOCAL_NTP_IMAGES_LOGO_PNG, "image/png" }, |
62 { "images/white_google_logo.png", | 62 { "images/white_google_logo.png", |
63 IDR_LOCAL_NTP_IMAGES_WHITE_LOGO_PNG, "image/png" }, | 63 IDR_LOCAL_NTP_IMAGES_WHITE_LOGO_PNG, "image/png" }, |
| 64 { "roboto.woff", IDR_ROBOTO_WOFF, "font/woff" }, |
| 65 { "roboto.woff2", IDR_ROBOTO_WOFF2, "font/woff2" }, |
64 }; | 66 }; |
65 | 67 |
66 // Strips any query parameters from the specified path. | 68 // Strips any query parameters from the specified path. |
67 std::string StripParameters(const std::string& path) { | 69 std::string StripParameters(const std::string& path) { |
68 return path.substr(0, path.find("?")); | 70 return path.substr(0, path.find("?")); |
69 } | 71 } |
70 | 72 |
71 bool DefaultSearchProviderIsGoogle(Profile* profile) { | 73 bool DefaultSearchProviderIsGoogle(Profile* profile) { |
72 if (!profile) | 74 if (!profile) |
73 return false; | 75 return false; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 void LocalNtpSource::SendResourceWithClass( | 230 void LocalNtpSource::SendResourceWithClass( |
229 int resource_id, | 231 int resource_id, |
230 const std::string& class_name, | 232 const std::string& class_name, |
231 const content::URLDataSource::GotDataCallback& callback) { | 233 const content::URLDataSource::GotDataCallback& callback) { |
232 base::StringPiece resource_data = | 234 base::StringPiece resource_data = |
233 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | 235 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
234 std::string response(resource_data.as_string()); | 236 std::string response(resource_data.as_string()); |
235 ReplaceFirstSubstringAfterOffset(&response, 0, "{{CLASS}}", class_name); | 237 ReplaceFirstSubstringAfterOffset(&response, 0, "{{CLASS}}", class_name); |
236 callback.Run(base::RefCountedString::TakeString(&response)); | 238 callback.Run(base::RefCountedString::TakeString(&response)); |
237 } | 239 } |
OLD | NEW |