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

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: Addressed comments. 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 e03a9e2b57419c79506a2b1e57f0cd99ec062b25..aeffd04a25c7d5ed4f3e687096c839ec90076a8c 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
@@ -189,10 +205,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_; }
@@ -287,7 +302,7 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
void CompleteInit(const WebContentsCreatedCallback& callback,
content::WebContents* guest_web_contents);
- void SetUpAutoSize();
+ void SetUpSizing();
void StartTrackingEmbedderZoomLevel();
void StopTrackingEmbedderZoomLevel();
@@ -359,9 +374,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_;
@@ -378,6 +390,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_;

Powered by Google App Engine
This is Rietveld 408576698