| OLD | NEW |
| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 content::RenderWidgetHostView* view = render_widget_host->GetView(); | 484 content::RenderWidgetHostView* view = render_widget_host->GetView(); |
| 485 if (!view) | 485 if (!view) |
| 486 return; | 486 return; |
| 487 | 487 |
| 488 const gfx::Size copy_size = | 488 const gfx::Size copy_size = |
| 489 GetCopySizeForThumbnail(view->GetViewBounds().size(), | 489 GetCopySizeForThumbnail(view->GetViewBounds().size(), |
| 490 gfx::Size(kThumbnailWidth, kThumbnailHeight)); | 490 gfx::Size(kThumbnailWidth, kThumbnailHeight)); |
| 491 skia::PlatformCanvas* temp_canvas = new skia::PlatformCanvas; | 491 skia::PlatformCanvas* temp_canvas = new skia::PlatformCanvas; |
| 492 web_contents_weak_factory_.reset( | 492 web_contents_weak_factory_.reset( |
| 493 new base::WeakPtrFactory<WebContents>(web_contents)); | 493 new base::WeakPtrFactory<WebContents>(web_contents)); |
| 494 render_widget_host->AsyncCopyFromBackingStore( | 494 render_widget_host->CopyFromBackingStore( |
| 495 gfx::Rect(), copy_size, temp_canvas, | 495 gfx::Rect(), copy_size, temp_canvas, |
| 496 base::Bind(&ThumbnailGenerator::AsyncUpdateThumbnailFinish, | 496 base::Bind(&ThumbnailGenerator::AsyncUpdateThumbnailFinish, |
| 497 weak_factory_.GetWeakPtr(), | 497 weak_factory_.GetWeakPtr(), |
| 498 web_contents_weak_factory_->GetWeakPtr(), | 498 web_contents_weak_factory_->GetWeakPtr(), |
| 499 base::Owned(temp_canvas))); | 499 base::Owned(temp_canvas))); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void ThumbnailGenerator::AsyncUpdateThumbnailFinish( | 502 void ThumbnailGenerator::AsyncUpdateThumbnailFinish( |
| 503 base::WeakPtr<WebContents> web_contents, | 503 base::WeakPtr<WebContents> web_contents, |
| 504 skia::PlatformCanvas* temp_canvas, | 504 skia::PlatformCanvas* temp_canvas, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |