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

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: 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 ThumbnailScore score; 523 ThumbnailScore score;
524 score.at_top = 524 score.at_top =
525 (web_contents->GetRenderViewHost()->GetLastScrollOffset().y() == 0); 525 (web_contents->GetRenderViewHost()->GetLastScrollOffset().y() == 0);
526 score.boring_score = ThumbnailGenerator::CalculateBoringScore(thumbnail); 526 score.boring_score = ThumbnailGenerator::CalculateBoringScore(thumbnail);
527 score.good_clipping = 527 score.good_clipping =
528 (clip_result == ThumbnailGenerator::kWiderThanTall || 528 (clip_result == ThumbnailGenerator::kWiderThanTall ||
529 clip_result == ThumbnailGenerator::kTallerThanWide || 529 clip_result == ThumbnailGenerator::kTallerThanWide ||
530 clip_result == ThumbnailGenerator::kNotClipped); 530 clip_result == ThumbnailGenerator::kNotClipped);
531 score.load_completed = (!load_interrupted_ && !web_contents->IsLoading()); 531 score.load_completed = (!load_interrupted_ && !web_contents->IsLoading());
532 532
533 gfx::Image image(new SkBitmap(thumbnail)); 533 gfx::Image image(thumbnail);
534 const GURL& url = web_contents->GetURL(); 534 const GURL& url = web_contents->GetURL();
535 top_sites->SetPageThumbnail(url, &image, score); 535 top_sites->SetPageThumbnail(url, &image, score);
536 VLOG(1) << "Thumbnail taken for " << url << ": " << score.ToString(); 536 VLOG(1) << "Thumbnail taken for " << url << ": " << score.ToString();
537 } 537 }
538 538
539 void ThumbnailGenerator::AsyncUpdateThumbnail( 539 void ThumbnailGenerator::AsyncUpdateThumbnail(
540 WebContents* web_contents) { 540 WebContents* web_contents) {
541 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 541 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
542 RenderWidgetHost* render_widget_host = web_contents->GetRenderViewHost(); 542 RenderWidgetHost* render_widget_host = web_contents->GetRenderViewHost();
543 content::RenderWidgetHostView* view = render_widget_host->GetView(); 543 content::RenderWidgetHostView* view = render_widget_host->GetView();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 612
613 void ThumbnailGenerator::DidStartLoading() { 613 void ThumbnailGenerator::DidStartLoading() {
614 load_interrupted_ = false; 614 load_interrupted_ = false;
615 } 615 }
616 616
617 void ThumbnailGenerator::StopNavigation() { 617 void ThumbnailGenerator::StopNavigation() {
618 // This function gets called when the page loading is interrupted by the 618 // This function gets called when the page loading is interrupted by the
619 // stop button. 619 // stop button.
620 load_interrupted_ = true; 620 load_interrupted_ = true;
621 } 621 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698