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

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: rebase 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') | no next file with comments »
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/scrollbar_size.h" 34 #include "ui/gfx/scrollbar_size.h"
34 #include "ui/gfx/skbitmap_operations.h" 35 #include "ui/gfx/skbitmap_operations.h"
35 36
36 #if defined(OS_WIN) 37 #if defined(OS_WIN)
37 #include "base/win/windows_version.h" 38 #include "base/win/windows_version.h"
38 #endif 39 #endif
39 40
40 // Overview 41 // Overview
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 264 }
264 265
265 void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer, 266 void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer,
266 const ThumbnailReadyCallback& callback, 267 const ThumbnailReadyCallback& callback,
267 gfx::Size page_size, 268 gfx::Size page_size,
268 gfx::Size desired_size) { 269 gfx::Size desired_size) {
269 // We are going to render the thumbnail asynchronously now, so keep 270 // We are going to render the thumbnail asynchronously now, so keep
270 // this callback for later lookup when the rendering is done. 271 // this callback for later lookup when the rendering is done.
271 static int sequence_num = 0; 272 static int sequence_num = 0;
272 sequence_num++; 273 sequence_num++;
274 float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView(
275 renderer->GetView()->GetNativeView()));
276 gfx::Size desired_size_in_pixel = desired_size.Scale(scale_factor);
273 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create( 277 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create(
274 desired_size.width() * desired_size.height() * 4, sequence_num)); 278 desired_size_in_pixel.GetArea() * 4, sequence_num));
275 279
276 #if defined(USE_X11) 280 #if defined(USE_X11)
277 // TODO: IPC a handle to the renderer like Windows. 281 // TODO: IPC a handle to the renderer like Windows.
278 // http://code.google.com/p/chromium/issues/detail?id=89777 282 // http://code.google.com/p/chromium/issues/detail?id=89777
279 NOTIMPLEMENTED(); 283 NOTIMPLEMENTED();
280 return; 284 return;
281 #else 285 #else
282 286
283 #if defined(OS_WIN) 287 #if defined(OS_WIN)
284 // Duplicate the handle to the DIB here because the renderer process does not 288 // Duplicate the handle to the DIB here because the renderer process does not
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 void ThumbnailGenerator::DidStartLoading( 597 void ThumbnailGenerator::DidStartLoading(
594 content::RenderViewHost* render_view_host) { 598 content::RenderViewHost* render_view_host) {
595 load_interrupted_ = false; 599 load_interrupted_ = false;
596 } 600 }
597 601
598 void ThumbnailGenerator::StopNavigation() { 602 void ThumbnailGenerator::StopNavigation() {
599 // This function gets called when the page loading is interrupted by the 603 // This function gets called when the page loading is interrupted by the
600 // stop button. 604 // stop button.
601 load_interrupted_ = true; 605 load_interrupted_ = true;
602 } 606 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698