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

Side by Side Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 10378009: Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: k Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab_contents/thumbnail_generator.h" 5 #include "chrome/browser/tab_contents/thumbnail_generator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 ThumbnailScore score; 464 ThumbnailScore score;
465 score.at_top = 465 score.at_top =
466 (web_contents->GetRenderViewHost()->GetLastScrollOffset().y() == 0); 466 (web_contents->GetRenderViewHost()->GetLastScrollOffset().y() == 0);
467 score.boring_score = ThumbnailGenerator::CalculateBoringScore(thumbnail); 467 score.boring_score = ThumbnailGenerator::CalculateBoringScore(thumbnail);
468 score.good_clipping = 468 score.good_clipping =
469 (clip_result == ThumbnailGenerator::kWiderThanTall || 469 (clip_result == ThumbnailGenerator::kWiderThanTall ||
470 clip_result == ThumbnailGenerator::kTallerThanWide || 470 clip_result == ThumbnailGenerator::kTallerThanWide ||
471 clip_result == ThumbnailGenerator::kNotClipped); 471 clip_result == ThumbnailGenerator::kNotClipped);
472 score.load_completed = (!load_interrupted_ && !web_contents->IsLoading()); 472 score.load_completed = (!load_interrupted_ && !web_contents->IsLoading());
473 473
474 gfx::Image image(new SkBitmap(thumbnail)); 474 gfx::Image image(thumbnail);
475 const GURL& url = web_contents->GetURL(); 475 const GURL& url = web_contents->GetURL();
476 top_sites->SetPageThumbnail(url, &image, score); 476 top_sites->SetPageThumbnail(url, &image, score);
477 VLOG(1) << "Thumbnail taken for " << url << ": " << score.ToString(); 477 VLOG(1) << "Thumbnail taken for " << url << ": " << score.ToString();
478 } 478 }
479 479
480 void ThumbnailGenerator::AsyncUpdateThumbnail( 480 void ThumbnailGenerator::AsyncUpdateThumbnail(
481 WebContents* web_contents) { 481 WebContents* web_contents) {
482 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 482 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
483 RenderWidgetHost* render_widget_host = web_contents->GetRenderViewHost(); 483 RenderWidgetHost* render_widget_host = web_contents->GetRenderViewHost();
484 content::RenderWidgetHostView* view = render_widget_host->GetView(); 484 content::RenderWidgetHostView* view = render_widget_host->GetView();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 553
554 void ThumbnailGenerator::DidStartLoading() { 554 void ThumbnailGenerator::DidStartLoading() {
555 load_interrupted_ = false; 555 load_interrupted_ = false;
556 } 556 }
557 557
558 void ThumbnailGenerator::StopNavigation() { 558 void ThumbnailGenerator::StopNavigation() {
559 // This function gets called when the page loading is interrupted by the 559 // This function gets called when the page loading is interrupted by the
560 // stop button. 560 // stop button.
561 load_interrupted_ = true; 561 load_interrupted_ = true;
562 } 562 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698