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/ui/webui/ntp/thumbnail_list_source.h" | 5 #include "chrome/browser/ui/webui/ntp/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" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 void ThumbnailListSource::StartDataRequest( | 84 void ThumbnailListSource::StartDataRequest( |
85 const std::string& path, | 85 const std::string& path, |
86 int render_process_id, | 86 int render_process_id, |
87 int render_view_id, | 87 int render_view_id, |
88 const content::URLDataSource::GotDataCallback& callback) { | 88 const content::URLDataSource::GotDataCallback& callback) { |
89 profile_->GetTopSites()->GetMostVisitedURLs( | 89 profile_->GetTopSites()->GetMostVisitedURLs( |
90 base::Bind(&ThumbnailListSource::OnMostVisitedURLsAvailable, | 90 base::Bind(&ThumbnailListSource::OnMostVisitedURLsAvailable, |
91 weak_ptr_factory_.GetWeakPtr(), | 91 weak_ptr_factory_.GetWeakPtr(), |
92 callback)); | 92 callback), false); |
93 } | 93 } |
94 | 94 |
95 std::string ThumbnailListSource::GetMimeType(const std::string& path) const { | 95 std::string ThumbnailListSource::GetMimeType(const std::string& path) const { |
96 return "text/html"; | 96 return "text/html"; |
97 } | 97 } |
98 | 98 |
99 base::MessageLoop* ThumbnailListSource::MessageLoopForRequestPath( | 99 base::MessageLoop* ThumbnailListSource::MessageLoopForRequestPath( |
100 const std::string& path) const { | 100 const std::string& path) const { |
101 // TopSites can be accessed from the IO thread. | 101 // TopSites can be accessed from the IO thread. |
102 return thumbnail_service_.get() ? | 102 return thumbnail_service_.get() ? |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 if (num_mv_with_thumb < num_mv) { | 140 if (num_mv_with_thumb < num_mv) { |
141 out.push_back("<h2>TopSites URLs without Thumbnails</h2>\n"); | 141 out.push_back("<h2>TopSites URLs without Thumbnails</h2>\n"); |
142 RenderMostVisitedURLList(mvurl_list, base64_encoded_pngs, false, &out); | 142 RenderMostVisitedURLList(mvurl_list, base64_encoded_pngs, false, &out); |
143 } | 143 } |
144 out.push_back(html_footer); | 144 out.push_back(html_footer); |
145 | 145 |
146 std::string out_html = JoinString(out, ""); | 146 std::string out_html = JoinString(out, ""); |
147 callback.Run(base::RefCountedString::TakeString(&out_html)); | 147 callback.Run(base::RefCountedString::TakeString(&out_html)); |
148 } | 148 } |
OLD | NEW |