Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: extensions/browser/guest_view/guest_view_base.h

Issue 847893002: Implemented explicit resizing from guestview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another small fix. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/guest_view_base.h
diff --git a/extensions/browser/guest_view/guest_view_base.h b/extensions/browser/guest_view/guest_view_base.h
index 42eb3bfe782bfec5b368a56b229931dcff3842e3..2a67a99118f57b517958cc6186bc3d69adf9affa 100644
--- a/extensions/browser/guest_view/guest_view_base.h
+++ b/extensions/browser/guest_view/guest_view_base.h
@@ -22,6 +22,22 @@ struct RendererContentSettingRules;
namespace extensions {
+// A struct of parameters for SetSize(). The parameters are all declared as
+// scoped pointers since they are all optional. Null pointers indicate that the
+// parameter has not been provided, and the last used value should be used. Note
+// that when |enable_auto_size| is true, providing |normal_size| is not
+// meaningful. This is because the normal size of the guestview is overridden
+// whenever autosizing occurs.
+struct SetSizeParams {
+ SetSizeParams();
+ ~SetSizeParams();
+
+ scoped_ptr<bool> enable_auto_size;
+ scoped_ptr<gfx::Size> min_size;
+ scoped_ptr<gfx::Size> max_size;
+ scoped_ptr<gfx::Size> normal_size;
+};
+
// A GuestViewBase is the base class browser-side API implementation for a
// <*view> tag. GuestViewBase maintains an association between a guest
// WebContents and an owner WebContents. It receives events issued from
@@ -190,10 +206,9 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
return !strcmp(GetViewType(), view_type);
}
- // Toggles autosize mode for this GuestView.
- void SetAutoSize(bool enabled,
- const gfx::Size& min_size,
- const gfx::Size& max_size);
+ // Used to toggle autosize mode for this GuestView, and set both the automatic
+ // and normal sizes.
+ void SetSize(const SetSizeParams& params);
bool initialized() const { return initialized_; }
@@ -291,7 +306,7 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
const WebContentsCreatedCallback& callback,
content::WebContents* guest_web_contents);
- void SetUpAutoSize(const base::DictionaryValue& params);
+ void SetUpSizing(const base::DictionaryValue& params);
void StartTrackingEmbedderZoomLevel();
void StopTrackingEmbedderZoomLevel();
@@ -363,9 +378,6 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
// away then this guest also self-destructs.
scoped_ptr<OpenerLifetimeObserver> opener_lifetime_observer_;
- // The size of the container element.
- gfx::Size element_size_;
-
// The size of the guest content. Note: In autosize mode, the container
// element may not match the size of the guest.
gfx::Size guest_size_;
@@ -382,6 +394,9 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
// The minimum size constraints of the container element in autosize mode.
gfx::Size min_auto_size_;
+ // The size that will be used when autosize mode is disabled.
+ gfx::Size normal_size_;
+
// Whether the guest view is inside a plugin document.
bool is_full_page_plugin_;
« no previous file with comments | « extensions/browser/api/guest_view/guest_view_internal_api.cc ('k') | extensions/browser/guest_view/guest_view_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698