| 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 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/gfx/gdi_util.h" | 12 #include "base/gfx/gdi_util.h" |
| 13 #include "base/gfx/image_operations.h" | |
| 14 #include "base/gfx/native_theme.h" | 13 #include "base/gfx/native_theme.h" |
| 15 #include "base/gfx/png_encoder.h" | 14 #include "base/gfx/png_encoder.h" |
| 16 #include "base/string_piece.h" | 15 #include "base/string_piece.h" |
| 17 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 18 #include "chrome/app/theme/theme_resources.h" | 17 #include "chrome/app/theme/theme_resources.h" |
| 19 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/gfx/emf.h" | 19 #include "chrome/common/gfx/emf.h" |
| 21 #include "chrome/common/gfx/favicon_size.h" | 20 #include "chrome/common/gfx/favicon_size.h" |
| 22 #include "chrome/common/gfx/color_utils.h" | 21 #include "chrome/common/gfx/color_utils.h" |
| 23 #include "chrome/common/jstemplate_builder.h" | 22 #include "chrome/common/jstemplate_builder.h" |
| 24 #include "chrome/common/l10n_util.h" | 23 #include "chrome/common/l10n_util.h" |
| 25 #include "chrome/common/page_zoom.h" | 24 #include "chrome/common/page_zoom.h" |
| 26 #include "chrome/common/resource_bundle.h" | 25 #include "chrome/common/resource_bundle.h" |
| 27 #include "chrome/common/thumbnail_score.h" | 26 #include "chrome/common/thumbnail_score.h" |
| 28 #include "chrome/common/chrome_plugin_lib.h" | 27 #include "chrome/common/chrome_plugin_lib.h" |
| 29 #include "chrome/renderer/about_handler.h" | 28 #include "chrome/renderer/about_handler.h" |
| 30 #include "chrome/renderer/chrome_plugin_host.h" | 29 #include "chrome/renderer/chrome_plugin_host.h" |
| 31 #include "chrome/renderer/debug_message_handler.h" | 30 #include "chrome/renderer/debug_message_handler.h" |
| 32 #include "chrome/renderer/greasemonkey_slave.h" | 31 #include "chrome/renderer/greasemonkey_slave.h" |
| 33 #include "chrome/renderer/localized_error.h" | 32 #include "chrome/renderer/localized_error.h" |
| 34 #include "chrome/renderer/renderer_resources.h" | 33 #include "chrome/renderer/renderer_resources.h" |
| 35 #include "chrome/renderer/visitedlink_slave.h" | 34 #include "chrome/renderer/visitedlink_slave.h" |
| 36 #include "chrome/renderer/webplugin_delegate_proxy.h" | 35 #include "chrome/renderer/webplugin_delegate_proxy.h" |
| 37 #include "chrome/views/message_box_view.h" | 36 #include "chrome/views/message_box_view.h" |
| 38 #include "net/base/escape.h" | 37 #include "net/base/escape.h" |
| 39 #include "net/base/net_errors.h" | 38 #include "net/base/net_errors.h" |
| 40 #include "skia/ext/bitmap_platform_device.h" | 39 #include "skia/ext/bitmap_platform_device.h" |
| 40 #include "skia/ext/image_operations.h" |
| 41 #include "skia/ext/vector_canvas.h" | 41 #include "skia/ext/vector_canvas.h" |
| 42 #include "webkit/default_plugin/default_plugin_shared.h" | 42 #include "webkit/default_plugin/default_plugin_shared.h" |
| 43 #include "webkit/glue/dom_operations.h" | 43 #include "webkit/glue/dom_operations.h" |
| 44 #include "webkit/glue/dom_serializer.h" | 44 #include "webkit/glue/dom_serializer.h" |
| 45 #include "webkit/glue/password_form.h" | 45 #include "webkit/glue/password_form.h" |
| 46 #include "webkit/glue/plugins/plugin_list.h" | 46 #include "webkit/glue/plugins/plugin_list.h" |
| 47 #include "webkit/glue/searchable_form_data.h" | 47 #include "webkit/glue/searchable_form_data.h" |
| 48 #include "webkit/glue/webdatasource.h" | 48 #include "webkit/glue/webdatasource.h" |
| 49 #include "webkit/glue/webdropdata.h" | 49 #include "webkit/glue/webdropdata.h" |
| 50 #include "webkit/glue/weberror.h" | 50 #include "webkit/glue/weberror.h" |
| 51 #include "webkit/glue/webframe.h" | 51 #include "webkit/glue/webframe.h" |
| 52 #include "webkit/glue/webhistoryitem.h" | 52 #include "webkit/glue/webhistoryitem.h" |
| 53 #include "webkit/glue/webinputevent.h" | 53 #include "webkit/glue/webinputevent.h" |
| 54 #include "webkit/glue/webkit_glue.h" | 54 #include "webkit/glue/webkit_glue.h" |
| 55 #include "webkit/glue/webpreferences.h" | 55 #include "webkit/glue/webpreferences.h" |
| 56 #include "webkit/glue/webresponse.h" | 56 #include "webkit/glue/webresponse.h" |
| 57 #include "webkit/glue/weburlrequest.h" | 57 #include "webkit/glue/weburlrequest.h" |
| 58 #include "webkit/glue/webview.h" | 58 #include "webkit/glue/webview.h" |
| 59 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 59 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 60 //#include "webkit/port/platform/graphics/PlatformContextSkia.h" | |
| 61 | 60 |
| 62 #include "generated_resources.h" | 61 #include "generated_resources.h" |
| 63 | 62 |
| 64 using base::TimeDelta; | 63 using base::TimeDelta; |
| 65 | 64 |
| 66 //----------------------------------------------------------------------------- | 65 //----------------------------------------------------------------------------- |
| 67 | 66 |
| 68 // define to write the time necessary for thumbnail/DOM text retrieval, | 67 // define to write the time necessary for thumbnail/DOM text retrieval, |
| 69 // respectively, into the system debug log | 68 // respectively, into the system debug log |
| 70 // #define TIME_BITMAP_RETRIEVAL | 69 // #define TIME_BITMAP_RETRIEVAL |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 score->good_clipping = true; | 786 score->good_clipping = true; |
| 788 } | 787 } |
| 789 } | 788 } |
| 790 | 789 |
| 791 score->at_top = (frame->ScrollOffset().height() == 0); | 790 score->at_top = (frame->ScrollOffset().height() == 0); |
| 792 | 791 |
| 793 SkBitmap subset; | 792 SkBitmap subset; |
| 794 device->accessBitmap(false).extractSubset(&subset, src_rect); | 793 device->accessBitmap(false).extractSubset(&subset, src_rect); |
| 795 | 794 |
| 796 // Resample the subset that we want to get it the right size. | 795 // Resample the subset that we want to get it the right size. |
| 797 *thumbnail = gfx::ImageOperations::Resize( | 796 *thumbnail = skia::ImageOperations::Resize( |
| 798 subset, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); | 797 subset, skia::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); |
| 799 | 798 |
| 800 score->boring_score = CalculateBoringScore(thumbnail); | 799 score->boring_score = CalculateBoringScore(thumbnail); |
| 801 | 800 |
| 802 #ifdef TIME_BITMAP_RETRIEVAL | 801 #ifdef TIME_BITMAP_RETRIEVAL |
| 803 double end = time_util::GetHighResolutionTimeNow(); | 802 double end = time_util::GetHighResolutionTimeNow(); |
| 804 char buf[128]; | 803 char buf[128]; |
| 805 sprintf_s(buf, "thumbnail in %gms\n", (end - begin) * 1000); | 804 sprintf_s(buf, "thumbnail in %gms\n", (end - begin) * 1000); |
| 806 OutputDebugStringA(buf); | 805 OutputDebugStringA(buf); |
| 807 #endif | 806 #endif |
| 808 return true; | 807 return true; |
| (...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2728 template_resource_id)); | 2727 template_resource_id)); |
| 2729 | 2728 |
| 2730 if (template_html.empty()) { | 2729 if (template_html.empty()) { |
| 2731 NOTREACHED() << "unable to load template. ID: " << template_resource_id; | 2730 NOTREACHED() << "unable to load template. ID: " << template_resource_id; |
| 2732 return ""; | 2731 return ""; |
| 2733 } | 2732 } |
| 2734 // "t" is the id of the templates root node. | 2733 // "t" is the id of the templates root node. |
| 2735 return jstemplate_builder::GetTemplateHtml( | 2734 return jstemplate_builder::GetTemplateHtml( |
| 2736 template_html, &error_strings, "t"); | 2735 template_html, &error_strings, "t"); |
| 2737 } | 2736 } |
| OLD | NEW |