Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 10831186: Make ThumbnailGenerator::AskForSnapshot support high DPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | content/renderer/render_widget.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
22 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/render_view_host.h" 24 #include "content/public/browser/render_view_host.h"
25 #include "content/public/browser/render_widget_host_view.h" 25 #include "content/public/browser/render_widget_host_view.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
28 #include "skia/ext/image_operations.h" 28 #include "skia/ext/image_operations.h"
29 #include "skia/ext/platform_canvas.h" 29 #include "skia/ext/platform_canvas.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 30 #include "third_party/skia/include/core/SkBitmap.h"
31 #include "ui/base/layout.h"
31 #include "ui/gfx/color_utils.h" 32 #include "ui/gfx/color_utils.h"
32 #include "ui/gfx/rect.h" 33 #include "ui/gfx/rect.h"
33 #include "ui/gfx/skbitmap_operations.h" 34 #include "ui/gfx/skbitmap_operations.h"
34 35
35 #if defined(OS_WIN) 36 #if defined(OS_WIN)
36 #include "base/win/windows_version.h" 37 #include "base/win/windows_version.h"
37 #endif 38 #endif
38 39
39 // Overview 40 // Overview
40 // -------- 41 // --------
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 212 }
212 213
213 void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer, 214 void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer,
214 const ThumbnailReadyCallback& callback, 215 const ThumbnailReadyCallback& callback,
215 gfx::Size page_size, 216 gfx::Size page_size,
216 gfx::Size desired_size) { 217 gfx::Size desired_size) {
217 // We are going to render the thumbnail asynchronously now, so keep 218 // We are going to render the thumbnail asynchronously now, so keep
218 // this callback for later lookup when the rendering is done. 219 // this callback for later lookup when the rendering is done.
219 static int sequence_num = 0; 220 static int sequence_num = 0;
220 sequence_num++; 221 sequence_num++;
222 float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView(
223 renderer->GetView()->GetNativeView()));
224 gfx::Size desired_pixel_size = desired_size.Scale(scale_factor);
oshima 2012/08/07 03:22:21 I think desired_size_in_pixel is more clear and be
mazda 2012/08/07 03:55:50 Done.
221 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create( 225 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create(
222 desired_size.width() * desired_size.height() * 4, sequence_num)); 226 desired_pixel_size.GetArea() * 4, sequence_num));
223 227
224 #if defined(USE_X11) 228 #if defined(USE_X11)
225 // TODO: IPC a handle to the renderer like Windows. 229 // TODO: IPC a handle to the renderer like Windows.
226 // http://code.google.com/p/chromium/issues/detail?id=89777 230 // http://code.google.com/p/chromium/issues/detail?id=89777
227 NOTIMPLEMENTED(); 231 NOTIMPLEMENTED();
228 return; 232 return;
229 #else 233 #else
230 234
231 #if defined(OS_WIN) 235 #if defined(OS_WIN)
232 // Duplicate the handle to the DIB here because the renderer process does not 236 // Duplicate the handle to the DIB here because the renderer process does not
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 void ThumbnailGenerator::DidStartLoading( 572 void ThumbnailGenerator::DidStartLoading(
569 content::RenderViewHost* render_view_host) { 573 content::RenderViewHost* render_view_host) {
570 load_interrupted_ = false; 574 load_interrupted_ = false;
571 } 575 }
572 576
573 void ThumbnailGenerator::StopNavigation() { 577 void ThumbnailGenerator::StopNavigation() {
574 // This function gets called when the page loading is interrupted by the 578 // This function gets called when the page loading is interrupted by the
575 // stop button. 579 // stop button.
576 load_interrupted_ = true; 580 load_interrupted_ = true;
577 } 581 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | content/renderer/render_widget.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698