| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // | 44 // |
| 45 // When a renderer is about to be hidden (this usually occurs when the | 45 // When a renderer is about to be hidden (this usually occurs when the |
| 46 // current tab is closed or another tab is clicked), update the | 46 // current tab is closed or another tab is clicked), update the |
| 47 // thumbnail for the tab rendered by the renderer, if needed. The | 47 // thumbnail for the tab rendered by the renderer, if needed. The |
| 48 // heuristics to judge whether or not to update the thumbnail is | 48 // heuristics to judge whether or not to update the thumbnail is |
| 49 // implemented in ShouldUpdateThumbnail(). | 49 // implemented in ShouldUpdateThumbnail(). |
| 50 // | 50 // |
| 51 // We'll likely revise the algorithm to improve quality of thumbnails this | 51 // We'll likely revise the algorithm to improve quality of thumbnails this |
| 52 // service generates. | 52 // service generates. |
| 53 | 53 |
| 54 using content::RenderViewHost; |
| 55 using content::RenderWidgetHost; |
| 54 using content::WebContents; | 56 using content::WebContents; |
| 55 | 57 |
| 56 namespace { | 58 namespace { |
| 57 | 59 |
| 58 static const int kThumbnailWidth = 212; | 60 static const int kThumbnailWidth = 212; |
| 59 static const int kThumbnailHeight = 132; | 61 static const int kThumbnailHeight = 132; |
| 60 | 62 |
| 61 static const char kThumbnailHistogramName[] = "Thumbnail.ComputeMS"; | 63 static const char kThumbnailHistogramName[] = "Thumbnail.ComputeMS"; |
| 62 | 64 |
| 63 // Creates a downsampled thumbnail for the given RenderWidgetHost's backing | 65 // Creates a downsampled thumbnail for the given RenderWidgetHost's backing |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 513 |
| 512 void ThumbnailGenerator::DidStartLoading() { | 514 void ThumbnailGenerator::DidStartLoading() { |
| 513 load_interrupted_ = false; | 515 load_interrupted_ = false; |
| 514 } | 516 } |
| 515 | 517 |
| 516 void ThumbnailGenerator::StopNavigation() { | 518 void ThumbnailGenerator::StopNavigation() { |
| 517 // This function gets called when the page loading is interrupted by the | 519 // This function gets called when the page loading is interrupted by the |
| 518 // stop button. | 520 // stop button. |
| 519 load_interrupted_ = true; | 521 load_interrupted_ = true; |
| 520 } | 522 } |
| OLD | NEW |