OLD | NEW |
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/suggestions/suggestions_source.h" | 5 #include "chrome/browser/search/suggestions/suggestions_source.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 line += it->second; | 71 line += it->second; |
72 line += "'>"; | 72 line += "'>"; |
73 } | 73 } |
74 line += "</a> Expires in "; | 74 line += "</a> Expires in "; |
75 line += base::UTF16ToUTF8(remaining_time_formatted); | 75 line += base::UTF16ToUTF8(remaining_time_formatted); |
76 line += "</li>\n"; | 76 line += "</li>\n"; |
77 out.push_back(line); | 77 out.push_back(line); |
78 } | 78 } |
79 out.push_back("</ul>"); | 79 out.push_back("</ul>"); |
80 out.push_back(kHtmlFooter); | 80 out.push_back(kHtmlFooter); |
81 *output = JoinString(out, ""); | 81 *output = base::JoinString(out, base::StringPiece()); |
82 } | 82 } |
83 | 83 |
84 // Fills |output| with the HTML needed to display that no suggestions are | 84 // Fills |output| with the HTML needed to display that no suggestions are |
85 // available. | 85 // available. |
86 void RenderOutputHtmlNoSuggestions(std::string* output) { | 86 void RenderOutputHtmlNoSuggestions(std::string* output) { |
87 std::vector<std::string> out; | 87 std::vector<std::string> out; |
88 out.push_back(kHtmlHeader); | 88 out.push_back(kHtmlHeader); |
89 out.push_back(kHtmlBody); | 89 out.push_back(kHtmlBody); |
90 out.push_back("<h1>Suggestions</h1>\n"); | 90 out.push_back("<h1>Suggestions</h1>\n"); |
91 out.push_back("<p>You have no suggestions.</p>\n"); | 91 out.push_back("<p>You have no suggestions.</p>\n"); |
92 out.push_back(kHtmlFooter); | 92 out.push_back(kHtmlFooter); |
93 *output = JoinString(out, ""); | 93 *output = base::JoinString(out, base::StringPiece()); |
94 } | 94 } |
95 | 95 |
96 } // namespace | 96 } // namespace |
97 | 97 |
98 SuggestionsSource::SuggestionsSource(Profile* profile) | 98 SuggestionsSource::SuggestionsSource(Profile* profile) |
99 : profile_(profile), weak_ptr_factory_(this) {} | 99 : profile_(profile), weak_ptr_factory_(this) {} |
100 | 100 |
101 SuggestionsSource::~SuggestionsSource() {} | 101 SuggestionsSource::~SuggestionsSource() {} |
102 | 102 |
103 SuggestionsSource::RequestContext::RequestContext( | 103 SuggestionsSource::RequestContext::RequestContext( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 std::string encoded_output; | 190 std::string encoded_output; |
191 base::Base64Encode(std::string(output.begin(), output.end()), | 191 base::Base64Encode(std::string(output.begin(), output.end()), |
192 &encoded_output); | 192 &encoded_output); |
193 context->base64_encoded_pngs[url] = "data:image/png;base64,"; | 193 context->base64_encoded_pngs[url] = "data:image/png;base64,"; |
194 context->base64_encoded_pngs[url] += encoded_output; | 194 context->base64_encoded_pngs[url] += encoded_output; |
195 } | 195 } |
196 barrier.Run(); | 196 barrier.Run(); |
197 } | 197 } |
198 | 198 |
199 } // namespace suggestions | 199 } // namespace suggestions |
OLD | NEW |