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