| 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/thumbnails/thumbnail_tab_helper.h" | 5 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/history/top_sites.h" | 9 #include "chrome/browser/history/top_sites.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 break; | 100 break; |
| 101 } | 101 } |
| 102 return copy_size; | 102 return copy_size; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Returns the size of the thumbnail stored in the database in pixel. | 105 // Returns the size of the thumbnail stored in the database in pixel. |
| 106 gfx::Size GetThumbnailSizeInPixel() { | 106 gfx::Size GetThumbnailSizeInPixel() { |
| 107 gfx::Size thumbnail_size(kThumbnailWidth, kThumbnailHeight); | 107 gfx::Size thumbnail_size(kThumbnailWidth, kThumbnailHeight); |
| 108 // Determine the resolution of the thumbnail based on the primary monitor. | 108 // Determine the resolution of the thumbnail based on the primary monitor. |
| 109 // TODO(oshima): Use device's default scale factor. | 109 // TODO(oshima): Use device's default scale factor. |
| 110 gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay(); | 110 gfx::Display primary_display = |
| 111 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 111 return thumbnail_size.Scale(primary_display.device_scale_factor()); | 112 return thumbnail_size.Scale(primary_display.device_scale_factor()); |
| 112 } | 113 } |
| 113 | 114 |
| 114 // Returns the clipping rectangle that is used for creating a thumbnail with | 115 // Returns the clipping rectangle that is used for creating a thumbnail with |
| 115 // the size of |desired_size| from the bitmap with the size of |source_size|. | 116 // the size of |desired_size| from the bitmap with the size of |source_size|. |
| 116 // The type of clipping that needs to be done is assigned to |clip_result|. | 117 // The type of clipping that needs to be done is assigned to |clip_result|. |
| 117 gfx::Rect GetClippingRect(const gfx::Size& source_size, | 118 gfx::Rect GetClippingRect(const gfx::Size& source_size, |
| 118 const gfx::Size& desired_size, | 119 const gfx::Size& desired_size, |
| 119 ThumbnailTabHelper::ClipResult* clip_result) { | 120 ThumbnailTabHelper::ClipResult* clip_result) { |
| 120 DCHECK(clip_result); | 121 DCHECK(clip_result); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void ThumbnailTabHelper::DidStartLoading( | 476 void ThumbnailTabHelper::DidStartLoading( |
| 476 content::RenderViewHost* render_view_host) { | 477 content::RenderViewHost* render_view_host) { |
| 477 load_interrupted_ = false; | 478 load_interrupted_ = false; |
| 478 } | 479 } |
| 479 | 480 |
| 480 void ThumbnailTabHelper::StopNavigation() { | 481 void ThumbnailTabHelper::StopNavigation() { |
| 481 // This function gets called when the page loading is interrupted by the | 482 // This function gets called when the page loading is interrupted by the |
| 482 // stop button. | 483 // stop button. |
| 483 load_interrupted_ = true; | 484 load_interrupted_ = true; |
| 484 } | 485 } |
| OLD | NEW |