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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 9030010: Move most of the remaining users of WebContentsObserver::tab_contents() to use web_contents(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/thumbnail_generator.h ('k') | chrome/browser/tabs/tab_finder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/thumbnail_generator.cc
===================================================================
--- chrome/browser/tab_contents/thumbnail_generator.cc (revision 115777)
+++ chrome/browser/tab_contents/thumbnail_generator.cc (working copy)
@@ -50,6 +50,8 @@
// We'll likely revise the algorithm to improve quality of thumbnails this
// service generates.
+using content::WebContents;
+
namespace {
static const int kThumbnailWidth = 212;
@@ -360,12 +362,12 @@
}
void ThumbnailGenerator::WidgetHidden(RenderWidgetHost* widget) {
- // tab_contents_ can be NULL, if StartThumbnailing() is not called, but
+ // web_contents() can be NULL, if StartThumbnailing() is not called, but
// MonitorRenderer() is called. The use case is found in
// chrome/test/base/ui_test_utils.cc.
- if (!tab_contents())
+ if (!web_contents())
return;
- UpdateThumbnailIfNecessary(tab_contents());
+ UpdateThumbnailIfNecessary(web_contents());
}
void ThumbnailGenerator::TabContentsDisconnected(TabContents* contents) {
@@ -446,10 +448,10 @@
}
void ThumbnailGenerator::UpdateThumbnailIfNecessary(
- TabContents* tab_contents) {
- const GURL& url = tab_contents->GetURL();
+ WebContents* web_contents) {
+ const GURL& url = web_contents->GetURL();
Profile* profile =
- Profile::FromBrowserContext(tab_contents->GetBrowserContext());
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
history::TopSites* top_sites = profile->GetTopSites();
// Skip if we don't need to update the thumbnail.
if (!ShouldUpdateThumbnail(profile, top_sites, url))
@@ -458,7 +460,7 @@
const int options = ThumbnailGenerator::kClippedThumbnail;
ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped;
SkBitmap thumbnail = GetThumbnailForRendererWithOptions(
- tab_contents->GetRenderViewHost(), options, &clip_result);
+ web_contents->GetRenderViewHost(), options, &clip_result);
// Failed to generate a thumbnail. Maybe the tab is in the background?
if (thumbnail.isNull())
return;
@@ -466,12 +468,12 @@
// Compute the thumbnail score.
ThumbnailScore score;
score.at_top =
- (tab_contents->GetRenderViewHost()->last_scroll_offset().y() == 0);
+ (web_contents->GetRenderViewHost()->last_scroll_offset().y() == 0);
score.boring_score = ThumbnailGenerator::CalculateBoringScore(&thumbnail);
score.good_clipping =
(clip_result == ThumbnailGenerator::kTallerThanWide ||
clip_result == ThumbnailGenerator::kNotClipped);
- score.load_completed = (!load_interrupted_ && !tab_contents->IsLoading());
+ score.load_completed = (!load_interrupted_ && !web_contents->IsLoading());
gfx::Image image(new SkBitmap(thumbnail));
top_sites->SetPageThumbnail(url, &image, score);
« no previous file with comments | « chrome/browser/tab_contents/thumbnail_generator.h ('k') | chrome/browser/tabs/tab_finder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698