Commit ba0dc14f authored by fsamuel@chromium.org's avatar fsamuel@chromium.org

Browser Plugin: Remove Zoom

With the zoom refactor in flight: https://codereview.chromium.org/287093002/, zoom
plumbing for BrowserPlugin in the content layer is now entirely dead code. We need to revisit zoom in
the chrome layer for <webview> so that the embedder's zoom is propagated to the guests.

This will be done at a later time when we need to get <webview> in WebUI working again.

BUG=330264
TBR=jam@chromium.org for trivial browser_plugin_guest_delegate.h code deletion.

Review URL: https://codereview.chromium.org/303423002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273959 0039d316-1c4b-4281-b951-d872f2087c98
parent 8fc28d72
...@@ -569,19 +569,6 @@ void WebViewGuest::Observe(int type, ...@@ -569,19 +569,6 @@ void WebViewGuest::Observe(int type,
} }
} }
void WebViewGuest::SetZoom(double zoom_factor) {
double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor);
content::HostZoomMap::SetZoomLevel(guest_web_contents(), zoom_level);
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_);
args->SetDouble(webview::kNewZoomFactor, zoom_factor);
DispatchEvent(
new GuestViewBase::Event(webview::kEventZoomChange, args.Pass()));
current_zoom_factor_ = zoom_factor;
}
double WebViewGuest::GetZoom() { double WebViewGuest::GetZoom() {
return current_zoom_factor_; return current_zoom_factor_;
} }
...@@ -1268,6 +1255,19 @@ void WebViewGuest::SetName(const std::string& name) { ...@@ -1268,6 +1255,19 @@ void WebViewGuest::SetName(const std::string& name) {
Send(new ChromeViewMsg_SetName(routing_id(), name_)); Send(new ChromeViewMsg_SetName(routing_id(), name_));
} }
void WebViewGuest::SetZoom(double zoom_factor) {
double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor);
content::HostZoomMap::SetZoomLevel(guest_web_contents(), zoom_level);
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_);
args->SetDouble(webview::kNewZoomFactor, zoom_factor);
DispatchEvent(
new GuestViewBase::Event(webview::kEventZoomChange, args.Pass()));
current_zoom_factor_ = zoom_factor;
}
void WebViewGuest::Destroy() { void WebViewGuest::Destroy() {
if (!attached() && GetOpener()) if (!attached() && GetOpener())
GetOpener()->pending_new_windows_.erase(this); GetOpener()->pending_new_windows_.erase(this);
......
...@@ -63,6 +63,9 @@ class WebViewGuest : public GuestView<WebViewGuest>, ...@@ -63,6 +63,9 @@ class WebViewGuest : public GuestView<WebViewGuest>,
// Sets the frame name of the guest. // Sets the frame name of the guest.
void SetName(const std::string& name); void SetName(const std::string& name);
// Set the zoom factor.
void SetZoom(double zoom_factor);
// GuestViewBase implementation. // GuestViewBase implementation.
virtual void Attach(content::WebContents* embedder_web_contents, virtual void Attach(content::WebContents* embedder_web_contents,
const base::DictionaryValue& args) OVERRIDE; const base::DictionaryValue& args) OVERRIDE;
...@@ -139,9 +142,6 @@ class WebViewGuest : public GuestView<WebViewGuest>, ...@@ -139,9 +142,6 @@ class WebViewGuest : public GuestView<WebViewGuest>,
const content::NotificationSource& source, const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE; const content::NotificationDetails& details) OVERRIDE;
// Set the zoom factor.
virtual void SetZoom(double zoom_factor) OVERRIDE;
// Returns the current zoom factor. // Returns the current zoom factor.
double GetZoom(); double GetZoom();
......
...@@ -86,23 +86,6 @@ void BrowserPluginEmbedder::DidSendScreenRects() { ...@@ -86,23 +86,6 @@ void BrowserPluginEmbedder::DidSendScreenRects() {
base::Unretained(this))); base::Unretained(this)));
} }
bool BrowserPluginEmbedder::SetZoomLevelCallback(
double level, WebContents* guest_web_contents) {
double zoom_factor = content::ZoomLevelToZoomFactor(level);
static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()->
SetZoom(zoom_factor);
// Not handled => Iterate over all guests.
return false;
}
void BrowserPluginEmbedder::SetZoomLevel(double level) {
GetBrowserPluginGuestManager()->ForEachGuest(
GetWebContents(), base::Bind(
&BrowserPluginEmbedder::SetZoomLevelCallback,
base::Unretained(this),
level));
}
bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) { bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message) IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message)
......
...@@ -56,9 +56,6 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { ...@@ -56,9 +56,6 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver {
factory_ = factory; factory_ = factory;
} }
// Sets the zoom level for all guests within this embedder.
void SetZoomLevel(double level);
// WebContentsObserver implementation. // WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
......
...@@ -342,11 +342,6 @@ void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) { ...@@ -342,11 +342,6 @@ void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) {
UpdateVisibility(); UpdateVisibility();
} }
void BrowserPluginGuest::SetZoom(double zoom_factor) {
if (delegate_)
delegate_->SetZoom(zoom_factor);
}
void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) { void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) {
SendMessageToEmbedder( SendMessageToEmbedder(
new BrowserPluginMsg_SetMouseLock(instance_id(), allow)); new BrowserPluginMsg_SetMouseLock(instance_id(), allow));
......
...@@ -210,8 +210,6 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver { ...@@ -210,8 +210,6 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver {
BrowserPluginGuest::factory_ = factory; BrowserPluginGuest::factory_ = factory;
} }
void SetZoom(double zoom_factor);
void PointerLockPermissionResponse(bool allow); void PointerLockPermissionResponse(bool allow);
private: private:
......
...@@ -26,9 +26,6 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate { ...@@ -26,9 +26,6 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Notification that the embedder has completed attachment. // Notification that the embedder has completed attachment.
virtual void DidAttach() {} virtual void DidAttach() {}
// Requests setting the zoom level to the provided |zoom_level|.
virtual void SetZoom(double zoom_factor) {}
virtual bool IsDragAndDropEnabled(); virtual bool IsDragAndDropEnabled();
// Notifies that the content size of the guest has changed in autosize mode. // Notifies that the content size of the guest has changed in autosize mode.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment