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/render_widget_snapshot_taker.h" | 5 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/public/browser/notification_details.h" | 9 #include "content/public/browser/notification_details.h" |
10 #include "content/public/browser/notification_source.h" | 10 #include "content/public/browser/notification_source.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 const SnapshotReadyCallback& callback, | 41 const SnapshotReadyCallback& callback, |
42 gfx::Size page_size, | 42 gfx::Size page_size, |
43 gfx::Size desired_size) { | 43 gfx::Size desired_size) { |
44 // We are going to render the thumbnail asynchronously now, so keep | 44 // We are going to render the thumbnail asynchronously now, so keep |
45 // this callback for later lookup when the rendering is done. | 45 // this callback for later lookup when the rendering is done. |
46 static int sequence_num = 0; | 46 static int sequence_num = 0; |
47 sequence_num++; | 47 sequence_num++; |
48 float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView( | 48 float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView( |
49 renderer->GetView()->GetNativeView())); | 49 renderer->GetView()->GetNativeView())); |
50 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize( | 50 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize( |
51 desired_size.Scale(scale_factor)); | 51 gfx::ScaleSize(desired_size, scale_factor)); |
52 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create( | 52 scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create( |
53 desired_size_in_pixel.GetArea() * 4, sequence_num)); | 53 desired_size_in_pixel.GetArea() * 4, sequence_num)); |
54 | 54 |
55 #if defined(USE_X11) | 55 #if defined(USE_X11) |
56 // TODO: IPC a handle to the renderer like Windows. | 56 // TODO: IPC a handle to the renderer like Windows. |
57 // http://code.google.com/p/chromium/issues/detail?id=89777 | 57 // http://code.google.com/p/chromium/issues/detail?id=89777 |
58 NOTIMPLEMENTED(); | 58 NOTIMPLEMENTED(); |
59 return; | 59 return; |
60 #else | 60 #else |
61 | 61 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 int new_count = --host_monitor_counts_[renderer]; | 184 int new_count = --host_monitor_counts_[renderer]; |
185 if (new_count == 0) { | 185 if (new_count == 0) { |
186 host_monitor_counts_.erase(renderer); | 186 host_monitor_counts_.erase(renderer); |
187 registrar_.Remove( | 187 registrar_.Remove( |
188 this, | 188 this, |
189 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK
, | 189 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK
, |
190 renderer_source); | 190 renderer_source); |
191 } | 191 } |
192 } | 192 } |
193 } | 193 } |
OLD | NEW |