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 IPC::Message* thumbnail_msg = new IPC::Message(routing_id_, | 457 Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail)); |
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); | |
463 } | 458 } |
464 | 459 |
465 int RenderView::SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params, | 460 int RenderView::SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params, |
466 WebFrame* frame) { | 461 WebFrame* frame) { |
467 float ratio = static_cast<float>(params.desired_dpi / params.dpi); | 462 float ratio = static_cast<float>(params.desired_dpi / params.dpi); |
468 float paper_width = params.printable_size.width() * ratio; | 463 float paper_width = params.printable_size.width() * ratio; |
469 float paper_height = params.printable_size.height() * ratio; | 464 float paper_height = params.printable_size.height() * ratio; |
470 float minLayoutWidth = static_cast<float>(paper_width * params.min_shrink); | 465 float minLayoutWidth = static_cast<float>(paper_width * params.min_shrink); |
471 float maxLayoutWidth = static_cast<float>(paper_width * params.max_shrink); | 466 float maxLayoutWidth = static_cast<float>(paper_width * params.max_shrink); |
472 | 467 |
(...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 template_resource_id)); | 2852 template_resource_id)); |
2858 | 2853 |
2859 if (template_html.empty()) { | 2854 if (template_html.empty()) { |
2860 NOTREACHED() << "unable to load template. ID: " << template_resource_id; | 2855 NOTREACHED() << "unable to load template. ID: " << template_resource_id; |
2861 return ""; | 2856 return ""; |
2862 } | 2857 } |
2863 // "t" is the id of the templates root node. | 2858 // "t" is the id of the templates root node. |
2864 return jstemplate_builder::GetTemplateHtml( | 2859 return jstemplate_builder::GetTemplateHtml( |
2865 template_html, &error_strings, "t"); | 2860 template_html, &error_strings, "t"); |
2866 } | 2861 } |
OLD | NEW |