| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 if (size_.IsEmpty()) | 447 if (size_.IsEmpty()) |
| 448 return; // Don't create an empty thumbnail! | 448 return; // Don't create an empty thumbnail! |
| 449 | 449 |
| 450 ThumbnailScore score; | 450 ThumbnailScore score; |
| 451 SkBitmap thumbnail; | 451 SkBitmap thumbnail; |
| 452 if (!CaptureThumbnail(main_frame, kThumbnailWidth, kThumbnailHeight, | 452 if (!CaptureThumbnail(main_frame, kThumbnailWidth, kThumbnailHeight, |
| 453 &thumbnail, &score)) | 453 &thumbnail, &score)) |
| 454 return; | 454 return; |
| 455 | 455 |
| 456 // send the thumbnail message to the browser process | 456 // send the thumbnail message to the browser process |
| 457 Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail)); | 457 IPC::Message* thumbnail_msg = new IPC::Message(routing_id_, |
| 458 ViewHostMsg_Thumbnail::ID, IPC::Message::PRIORITY_NORMAL); |
| 459 IPC::ParamTraits<GURL>::Write(thumbnail_msg, url); |
| 460 IPC::ParamTraits<ThumbnailScore>::Write(thumbnail_msg, score); |
| 461 IPC::ParamTraits<SkBitmap>::Write(thumbnail_msg, thumbnail); |
| 462 Send(thumbnail_msg); |
| 458 } | 463 } |
| 459 | 464 |
| 460 int RenderView::SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params, | 465 int RenderView::SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params, |
| 461 WebFrame* frame) { | 466 WebFrame* frame) { |
| 462 float ratio = static_cast<float>(params.desired_dpi / params.dpi); | 467 float ratio = static_cast<float>(params.desired_dpi / params.dpi); |
| 463 float paper_width = params.printable_size.width() * ratio; | 468 float paper_width = params.printable_size.width() * ratio; |
| 464 float paper_height = params.printable_size.height() * ratio; | 469 float paper_height = params.printable_size.height() * ratio; |
| 465 float minLayoutWidth = static_cast<float>(paper_width * params.min_shrink); | 470 float minLayoutWidth = static_cast<float>(paper_width * params.min_shrink); |
| 466 float maxLayoutWidth = static_cast<float>(paper_width * params.max_shrink); | 471 float maxLayoutWidth = static_cast<float>(paper_width * params.max_shrink); |
| 467 | 472 |
| (...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 template_resource_id)); | 2857 template_resource_id)); |
| 2853 | 2858 |
| 2854 if (template_html.empty()) { | 2859 if (template_html.empty()) { |
| 2855 NOTREACHED() << "unable to load template. ID: " << template_resource_id; | 2860 NOTREACHED() << "unable to load template. ID: " << template_resource_id; |
| 2856 return ""; | 2861 return ""; |
| 2857 } | 2862 } |
| 2858 // "t" is the id of the templates root node. | 2863 // "t" is the id of the templates root node. |
| 2859 return jstemplate_builder::GetTemplateHtml( | 2864 return jstemplate_builder::GetTemplateHtml( |
| 2860 template_html, &error_strings, "t"); | 2865 template_html, &error_strings, "t"); |
| 2861 } | 2866 } |
| OLD | NEW |