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/bitmap_platform_device_win.h" | 13 #include "base/gfx/bitmap_platform_device_win.h" |
14 #include "base/gfx/image_operations.h" | 14 #include "base/gfx/image_operations.h" |
15 #include "base/gfx/native_theme.h" | 15 #include "base/gfx/native_theme.h" |
16 #include "base/gfx/vector_canvas.h" | 16 #include "base/gfx/vector_canvas.h" |
17 #include "base/gfx/png_encoder.h" | 17 #include "base/gfx/png_encoder.h" |
18 #include "base/string_piece.h" | 18 #include "base/string_piece.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "chrome/app/theme/theme_resources.h" | 20 #include "chrome/app/theme/theme_resources.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/gfx/emf.h" | 22 #include "chrome/common/gfx/emf.h" |
23 #include "chrome/common/gfx/favicon_size.h" | 23 #include "chrome/common/gfx/favicon_size.h" |
24 #include "chrome/common/gfx/color_utils.h" | 24 #include "chrome/common/gfx/color_utils.h" |
25 #include "chrome/common/jstemplate_builder.h" | 25 #include "chrome/common/jstemplate_builder.h" |
26 #include "chrome/common/l10n_util.h" | 26 #include "chrome/common/l10n_util.h" |
| 27 #include "chrome/common/page_zoom.h" |
27 #include "chrome/common/resource_bundle.h" | 28 #include "chrome/common/resource_bundle.h" |
28 #include "chrome/common/text_zoom.h" | |
29 #include "chrome/common/thumbnail_score.h" | 29 #include "chrome/common/thumbnail_score.h" |
30 #include "chrome/common/chrome_plugin_lib.h" | 30 #include "chrome/common/chrome_plugin_lib.h" |
31 #include "chrome/renderer/about_handler.h" | 31 #include "chrome/renderer/about_handler.h" |
32 #include "chrome/renderer/chrome_plugin_host.h" | 32 #include "chrome/renderer/chrome_plugin_host.h" |
33 #include "chrome/renderer/debug_message_handler.h" | 33 #include "chrome/renderer/debug_message_handler.h" |
34 #include "chrome/renderer/localized_error.h" | 34 #include "chrome/renderer/localized_error.h" |
35 #include "chrome/renderer/renderer_resources.h" | 35 #include "chrome/renderer/renderer_resources.h" |
36 #include "chrome/renderer/visitedlink_slave.h" | 36 #include "chrome/renderer/visitedlink_slave.h" |
37 #include "chrome/renderer/webplugin_delegate_proxy.h" | 37 #include "chrome/renderer/webplugin_delegate_proxy.h" |
38 #include "chrome/views/message_box_view.h" | 38 #include "chrome/views/message_box_view.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 282 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
283 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) | 283 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) |
284 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) | 284 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) |
285 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) | 285 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) |
286 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 286 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
287 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 287 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
288 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 288 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
289 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 289 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
290 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 290 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
291 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 291 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
292 IPC_MESSAGE_HANDLER(ViewMsg_AlterTextSize, OnAlterTextSize) | 292 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
293 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 293 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
294 IPC_MESSAGE_HANDLER(ViewMsg_InspectElement, OnInspectElement) | 294 IPC_MESSAGE_HANDLER(ViewMsg_InspectElement, OnInspectElement) |
295 IPC_MESSAGE_HANDLER(ViewMsg_ShowJavaScriptConsole, OnShowJavaScriptConsole) | 295 IPC_MESSAGE_HANDLER(ViewMsg_ShowJavaScriptConsole, OnShowJavaScriptConsole) |
296 IPC_MESSAGE_HANDLER(ViewMsg_DownloadImage, OnDownloadImage) | 296 IPC_MESSAGE_HANDLER(ViewMsg_DownloadImage, OnDownloadImage) |
297 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 297 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
298 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) | 298 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) |
299 IPC_MESSAGE_HANDLER(ViewMsg_DebugAttach, OnDebugAttach) | 299 IPC_MESSAGE_HANDLER(ViewMsg_DebugAttach, OnDebugAttach) |
300 IPC_MESSAGE_HANDLER(ViewMsg_DebugDetach, OnDebugDetach) | 300 IPC_MESSAGE_HANDLER(ViewMsg_DebugDetach, OnDebugDetach) |
301 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 301 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
302 IPC_MESSAGE_HANDLER(ViewMsg_UploadFile, OnUploadFileRequest) | 302 IPC_MESSAGE_HANDLER(ViewMsg_UploadFile, OnUploadFileRequest) |
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 } | 2152 } |
2153 | 2153 |
2154 void RenderView::UserMetricsRecordAction(const std::wstring& action) { | 2154 void RenderView::UserMetricsRecordAction(const std::wstring& action) { |
2155 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action)); | 2155 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action)); |
2156 } | 2156 } |
2157 | 2157 |
2158 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { | 2158 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { |
2159 Send(new ViewHostMsg_DnsPrefetch(host_names)); | 2159 Send(new ViewHostMsg_DnsPrefetch(host_names)); |
2160 } | 2160 } |
2161 | 2161 |
2162 void RenderView::OnAlterTextSize(int size) { | 2162 void RenderView::OnZoom(int function) { |
2163 switch (size) { | 2163 static const bool kZoomIsTextOnly = false; |
2164 case text_zoom::TEXT_SMALLER: | 2164 switch (function) { |
2165 webview()->MakeTextSmaller(); | 2165 case PageZoom::SMALLER: |
| 2166 webview()->ZoomIn(kZoomIsTextOnly); |
2166 break; | 2167 break; |
2167 case text_zoom::TEXT_STANDARD: | 2168 case PageZoom::STANDARD: |
2168 webview()->MakeTextStandardSize(); | 2169 webview()->ResetZoom(); |
2169 break; | 2170 break; |
2170 case text_zoom::TEXT_LARGER: | 2171 case PageZoom::LARGER: |
2171 webview()->MakeTextLarger(); | 2172 webview()->ZoomIn(kZoomIsTextOnly); |
2172 break; | 2173 break; |
2173 default: | 2174 default: |
2174 NOTREACHED(); | 2175 NOTREACHED(); |
2175 } | 2176 } |
2176 } | 2177 } |
2177 | 2178 |
2178 void RenderView::OnSetPageEncoding(const std::wstring& encoding_name) { | 2179 void RenderView::OnSetPageEncoding(const std::wstring& encoding_name) { |
2179 webview()->SetPageEncoding(encoding_name); | 2180 webview()->SetPageEncoding(encoding_name); |
2180 } | 2181 } |
2181 | 2182 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2563 | 2564 |
2564 if (template_html.empty()) { | 2565 if (template_html.empty()) { |
2565 NOTREACHED() << "unable to load template. ID: " << template_resource_id; | 2566 NOTREACHED() << "unable to load template. ID: " << template_resource_id; |
2566 return ""; | 2567 return ""; |
2567 } | 2568 } |
2568 // "t" is the id of the templates root node. | 2569 // "t" is the id of the templates root node. |
2569 return jstemplate_builder::GetTemplateHtml( | 2570 return jstemplate_builder::GetTemplateHtml( |
2570 template_html, &error_strings, "t"); | 2571 template_html, &error_strings, "t"); |
2571 } | 2572 } |
2572 | 2573 |
OLD | NEW |