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

Side by Side Diff: chrome/browser/thumbnails/thumbnail_list_source.cc

Issue 507653002: [Guest mode] Make sure chrome://thumbnails doesn't crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 std::string ThumbnailListSource::GetSource() const { 88 std::string ThumbnailListSource::GetSource() const {
89 return chrome::kChromeUIThumbnailListHost; 89 return chrome::kChromeUIThumbnailListHost;
90 } 90 }
91 91
92 void ThumbnailListSource::StartDataRequest( 92 void ThumbnailListSource::StartDataRequest(
93 const std::string& path, 93 const std::string& path,
94 int render_process_id, 94 int render_process_id,
95 int render_frame_id, 95 int render_frame_id,
96 const content::URLDataSource::GotDataCallback& callback) { 96 const content::URLDataSource::GotDataCallback& callback) {
97 if (!profile_->GetTopSites()) {
98 callback.Run(NULL);
99 return;
100 }
101
97 profile_->GetTopSites()->GetMostVisitedURLs( 102 profile_->GetTopSites()->GetMostVisitedURLs(
98 base::Bind(&ThumbnailListSource::OnMostVisitedURLsAvailable, 103 base::Bind(&ThumbnailListSource::OnMostVisitedURLsAvailable,
99 weak_ptr_factory_.GetWeakPtr(), 104 weak_ptr_factory_.GetWeakPtr(),
100 callback), true); 105 callback), true);
101 } 106 }
102 107
103 std::string ThumbnailListSource::GetMimeType(const std::string& path) const { 108 std::string ThumbnailListSource::GetMimeType(const std::string& path) const {
104 return "text/html"; 109 return "text/html";
105 } 110 }
106 111
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 154 }
150 if (num_mv_with_thumb < num_mv) { 155 if (num_mv_with_thumb < num_mv) {
151 out.push_back("<h2>TopSites URLs without Thumbnails</h2>\n"); 156 out.push_back("<h2>TopSites URLs without Thumbnails</h2>\n");
152 RenderMostVisitedURLList(mvurl_list, base64_encoded_pngs, false, &out); 157 RenderMostVisitedURLList(mvurl_list, base64_encoded_pngs, false, &out);
153 } 158 }
154 out.push_back(kHtmlFooter); 159 out.push_back(kHtmlFooter);
155 160
156 std::string out_html = JoinString(out, ""); 161 std::string out_html = JoinString(out, "");
157 callback.Run(base::RefCountedString::TakeString(&out_html)); 162 callback.Run(base::RefCountedString::TakeString(&out_html));
158 } 163 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698