diff options
| author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 07:28:25 +0000 |
|---|---|---|
| committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 07:28:25 +0000 |
| commit | b75b829359b4b432d0462ab5011542f99f2021a5 (patch) | |
| tree | 564389d8698b140e97918a4cefd7ad18c7c99e7f /chrome/browser/renderer_host | |
| parent | 3ec5d92cbba6b7b13ead81ebfd9e3c202fae001d (diff) | |
| download | chromium_src-b75b829359b4b432d0462ab5011542f99f2021a5.zip chromium_src-b75b829359b4b432d0462ab5011542f99f2021a5.tar.gz chromium_src-b75b829359b4b432d0462ab5011542f99f2021a5.tar.bz2 | |
Chrome side of consolidating zoom code for pepper plugins (i.e. pdf) and the rest of Chrome. Allows plugins to have different zoom ranges, and also to update zoom on its own.
Review URL: http://codereview.chromium.org/3419023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
5 files changed, 45 insertions, 24 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 8d31005..0fabebe 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -863,8 +863,7 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) IPC_MESSAGE_HANDLER(ViewHostMsg_WebDatabaseAccessed, OnWebDatabaseAccessed) IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged) - IPC_MESSAGE_HANDLER(ViewHostMsg_SetDisplayingPDFContent, - OnSetDisplayingPDFContent) + IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestResult, OnSetSuggestResult) IPC_MESSAGE_HANDLER(ViewHostMsg_DetectedPhishingSite, OnDetectedPhishingSite) @@ -2064,8 +2063,10 @@ void RenderViewHost::OnWebDatabaseAccessed(const GURL& url, url, name, display_name, estimated_size, blocked_by_policy); } -void RenderViewHost::OnSetDisplayingPDFContent() { - delegate_->SetDisplayingPDFContent(); +void RenderViewHost::OnUpdateZoomLimits(int minimum_percent, + int maximum_percent, + bool remember) { + delegate_->UpdateZoomLimits(minimum_percent, maximum_percent, remember); } void RenderViewHost::OnSetSuggestResult(int32 page_id, diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 82277a3..dcb658d 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -679,7 +679,9 @@ class RenderViewHost : public RenderWidgetHost { const string16& display_name, unsigned long estimated_size, bool blocked_by_policy); - void OnSetDisplayingPDFContent(); + void OnUpdateZoomLimits(int minimum_percent, + int maximum_percent, + bool remember); void OnSetSuggestResult(int32 page_id, const std::string& result); void OnDetectedPhishingSite(const GURL& phishing_url, double phishing_score, diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index 2f0f5b4..58c94ad 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -835,8 +835,10 @@ class RenderViewHostDelegate { // A different node in the page got focused. virtual void FocusedNodeChanged() {} - // The content being displayed is a PDF. - virtual void SetDisplayingPDFContent() {} + // Updates the minimum and maximum zoom percentages. + virtual void UpdateZoomLimits(int minimum_percent, + int maximum_percent, + bool remember) {} protected: virtual ~RenderViewHostDelegate() {} diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 272fc55..de09a9f 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -1095,28 +1095,37 @@ void ResourceMessageFilter::OnV8HeapStatsOnUIThread( static_cast<size_t>(v8_memory_used)); } -void ResourceMessageFilter::OnDidZoomURL(const GURL& url, - int zoom_level) { +void ResourceMessageFilter::OnDidZoomURL(const IPC::Message& message, + double zoom_level, + bool remember, + const GURL& url) { ui_thread_helpers::PostTaskWhileRunningMenu(FROM_HERE, - NewRunnableMethod(this, - &ResourceMessageFilter::UpdateHostZoomLevelsOnUIThread, - url, zoom_level)); + NewRunnableMethod( + this, &ResourceMessageFilter::UpdateHostZoomLevelsOnUIThread, + zoom_level, remember, url, id(), message.routing_id())); } void ResourceMessageFilter::UpdateHostZoomLevelsOnUIThread( + double zoom_level, + bool remember, const GURL& url, - int zoom_level) { + int render_process_id, + int render_view_id) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); - host_zoom_map_->SetZoomLevel(url, zoom_level); - - // Notify renderers from this profile. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); - !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* render_process_host = i.GetCurrentValue(); - if (render_process_host->profile() == profile_) { - render_process_host->Send( - new ViewMsg_SetZoomLevelForCurrentURL(url, zoom_level)); + if (remember) { + host_zoom_map_->SetZoomLevel(url, zoom_level); + // Notify renderers from this profile. + for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + !i.IsAtEnd(); i.Advance()) { + RenderProcessHost* render_process_host = i.GetCurrentValue(); + if (render_process_host->profile() == profile_) { + render_process_host->Send( + new ViewMsg_SetZoomLevelForCurrentURL(url, zoom_level)); + } } + } else { + host_zoom_map_->SetTemporaryZoomLevel( + render_process_id, render_view_id, zoom_level); } } diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 3dd76bb..ae818f5 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -286,8 +286,15 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, int v8_memory_used, base::ProcessId renderer_id); - void OnDidZoomURL(const GURL& url, int zoom_level); - void UpdateHostZoomLevelsOnUIThread(const GURL& url, int zoom_level); + void OnDidZoomURL(const IPC::Message& message, + double zoom_level, + bool remember, + const GURL& url); + void UpdateHostZoomLevelsOnUIThread(double zoom_level, + bool remember, + const GURL& url, + int render_process_id, + int render_view_id); void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); |
