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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 break; | 121 break; |
122 } | 122 } |
123 return copy_size; | 123 return copy_size; |
124 } | 124 } |
125 | 125 |
126 // Returns the size of the thumbnail stored in the database in pixel. | 126 // Returns the size of the thumbnail stored in the database in pixel. |
127 gfx::Size GetThumbnailSizeInPixel() { | 127 gfx::Size GetThumbnailSizeInPixel() { |
128 gfx::Size thumbnail_size(kThumbnailWidth, kThumbnailHeight); | 128 gfx::Size thumbnail_size(kThumbnailWidth, kThumbnailHeight); |
129 // Determine the resolution of the thumbnail based on the primary monitor. | 129 // Determine the resolution of the thumbnail based on the primary monitor. |
130 // TODO(oshima): Use device's default scale factor. | 130 // TODO(oshima): Use device's default scale factor. |
131 gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay(); | 131 gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay( |
| 132 gfx::Screen::BadTwoWorldsContext()); |
132 return thumbnail_size.Scale(primary_display.device_scale_factor()); | 133 return thumbnail_size.Scale(primary_display.device_scale_factor()); |
133 } | 134 } |
134 | 135 |
135 // Returns the clipping rectangle that is used for creating a thumbnail with | 136 // Returns the clipping rectangle that is used for creating a thumbnail with |
136 // the size of |desired_size| from the bitmap with the size of |source_size|. | 137 // the size of |desired_size| from the bitmap with the size of |source_size|. |
137 // The type of clipping that needs to be done is assigned to |clip_result|. | 138 // The type of clipping that needs to be done is assigned to |clip_result|. |
138 gfx::Rect GetClippingRect(const gfx::Size& source_size, | 139 gfx::Rect GetClippingRect(const gfx::Size& source_size, |
139 const gfx::Size& desired_size, | 140 const gfx::Size& desired_size, |
140 ThumbnailGenerator::ClipResult* clip_result) { | 141 ThumbnailGenerator::ClipResult* clip_result) { |
141 DCHECK(clip_result); | 142 DCHECK(clip_result); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 void ThumbnailGenerator::DidStartLoading( | 638 void ThumbnailGenerator::DidStartLoading( |
638 content::RenderViewHost* render_view_host) { | 639 content::RenderViewHost* render_view_host) { |
639 load_interrupted_ = false; | 640 load_interrupted_ = false; |
640 } | 641 } |
641 | 642 |
642 void ThumbnailGenerator::StopNavigation() { | 643 void ThumbnailGenerator::StopNavigation() { |
643 // This function gets called when the page loading is interrupted by the | 644 // This function gets called when the page loading is interrupted by the |
644 // stop button. | 645 // stop button. |
645 load_interrupted_ = true; | 646 load_interrupted_ = true; |
646 } | 647 } |
OLD | NEW |