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/thumbnails/thumbnail_list_source.h" | 5 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "chrome/browser/history/top_sites.h" | |
15 #include "chrome/browser/history/top_sites_factory.h" | 14 #include "chrome/browser/history/top_sites_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/search/instant_io_context.h" | 16 #include "chrome/browser/search/instant_io_context.h" |
18 #include "chrome/browser/thumbnails/thumbnail_service.h" | 17 #include "chrome/browser/thumbnails/thumbnail_service.h" |
19 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" | 18 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" |
20 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "components/history/core/browser/top_sites.h" |
21 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
22 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const char kHtmlHeader[] = | 26 const char kHtmlHeader[] = |
27 "<!DOCTYPE html>\n<html>\n<head>\n<title>TopSites Thumbnails</title>\n" | 27 "<!DOCTYPE html>\n<html>\n<head>\n<title>TopSites Thumbnails</title>\n" |
28 "<meta charset=\"utf-8\">\n" | 28 "<meta charset=\"utf-8\">\n" |
29 "<style type=\"text/css\">\nimg.thumb {border: 1px solid black;}\n" | 29 "<style type=\"text/css\">\nimg.thumb {border: 1px solid black;}\n" |
30 "li {white-space: nowrap;}\n</style>\n"; | 30 "li {white-space: nowrap;}\n</style>\n"; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 if (num_mv_with_thumb < num_mv) { | 158 if (num_mv_with_thumb < num_mv) { |
159 out.push_back("<h2>TopSites URLs without Thumbnails</h2>\n"); | 159 out.push_back("<h2>TopSites URLs without Thumbnails</h2>\n"); |
160 RenderMostVisitedURLList(mvurl_list, base64_encoded_pngs, false, &out); | 160 RenderMostVisitedURLList(mvurl_list, base64_encoded_pngs, false, &out); |
161 } | 161 } |
162 out.push_back(kHtmlFooter); | 162 out.push_back(kHtmlFooter); |
163 | 163 |
164 std::string out_html = JoinString(out, ""); | 164 std::string out_html = JoinString(out, ""); |
165 callback.Run(base::RefCountedString::TakeString(&out_html)); | 165 callback.Run(base::RefCountedString::TakeString(&out_html)); |
166 } | 166 } |
OLD | NEW |