diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 22:55:17 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 22:55:17 +0000 |
commit | 630e26b1eb3461ee97211856b6ceb2821e99d655 (patch) | |
tree | bde01602f2d82c833642a854a9670f7f25ebd702 /chrome/renderer | |
parent | c82e56ca13fefb0a50662ef1cee872c06cd2b5e3 (diff) | |
download | chromium_src-630e26b1eb3461ee97211856b6ceb2821e99d655.zip chromium_src-630e26b1eb3461ee97211856b6ceb2821e99d655.tar.gz chromium_src-630e26b1eb3461ee97211856b6ceb2821e99d655.tar.bz2 |
Rename various text zoom related stuff to be more generic, since we now can
optionally zoom the page. I added an easy way in render_view to toggle between
text zoom and full page zoom, and allowed the embedder to specify this in the
glue layer. This allows me to fix the text zoom layout test, which specifically
asks that the text be zoomed.
Review URL: http://codereview.chromium.org/7320
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 21 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 11 |
2 files changed, 17 insertions, 15 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 722e67f..748e612 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -24,8 +24,8 @@ #include "chrome/common/gfx/color_utils.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" +#include "chrome/common/page_zoom.h" #include "chrome/common/resource_bundle.h" -#include "chrome/common/text_zoom.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/chrome_plugin_lib.h" #include "chrome/renderer/about_handler.h" @@ -289,7 +289,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) - IPC_MESSAGE_HANDLER(ViewMsg_AlterTextSize, OnAlterTextSize) + IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) IPC_MESSAGE_HANDLER(ViewMsg_InspectElement, OnInspectElement) IPC_MESSAGE_HANDLER(ViewMsg_ShowJavaScriptConsole, OnShowJavaScriptConsole) @@ -2159,16 +2159,17 @@ void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { Send(new ViewHostMsg_DnsPrefetch(host_names)); } -void RenderView::OnAlterTextSize(int size) { - switch (size) { - case text_zoom::TEXT_SMALLER: - webview()->MakeTextSmaller(); +void RenderView::OnZoom(int function) { + static const bool kZoomIsTextOnly = false; + switch (function) { + case PageZoom::SMALLER: + webview()->ZoomOut(kZoomIsTextOnly); break; - case text_zoom::TEXT_STANDARD: - webview()->MakeTextStandardSize(); + case PageZoom::STANDARD: + webview()->ResetZoom(); break; - case text_zoom::TEXT_LARGER: - webview()->MakeTextLarger(); + case PageZoom::LARGER: + webview()->ZoomIn(kZoomIsTextOnly); break; default: NOTREACHED(); diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 71faf63..51b9d93 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_RENDERER_RENDER_VIEW_H__ -#define CHROME_RENDERER_RENDER_VIEW_H__ +#ifndef CHROME_RENDERER_RENDER_VIEW_H_ +#define CHROME_RENDERER_RENDER_VIEW_H_ #include <string> #include <vector> @@ -14,6 +14,7 @@ #include "base/gfx/rect.h" #include "base/timer.h" #include "base/values.h" +#include "chrome/common/page_zoom.h" #include "chrome/common/resource_dispatcher.h" #ifdef CHROME_PERSONALIZATION #include "chrome/personalization/personalization.h" @@ -372,7 +373,7 @@ class RenderView : public RenderWidget, public WebViewDelegate, void OnShowJavaScriptConsole(); void OnCancelDownload(int32 download_id); void OnFind(const FindInPageRequest& request); - void OnAlterTextSize(int size); + void OnZoom(int function); void OnSetPageEncoding(const std::wstring& encoding_name); void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( @@ -620,7 +621,7 @@ class RenderView : public RenderWidget, public WebViewDelegate, // maintains the cache and other features of the accessibility tree. scoped_ptr<GlueAccessibility> glue_accessibility_; - DISALLOW_EVIL_CONSTRUCTORS(RenderView); + DISALLOW_COPY_AND_ASSIGN(RenderView); }; -#endif // CHROME_RENDERER_RENDER_VIEW_H__ +#endif // CHROME_RENDERER_RENDER_VIEW_H_ |