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

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

Issue 427883002: <webview>: Move autosize from content to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_frame_url
Patch Set: Initialize variable Created 6 years, 4 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: chrome/browser/guest_view/guest_view_base.h
diff --git a/chrome/browser/guest_view/guest_view_base.h b/chrome/browser/guest_view/guest_view_base.h
index 1ca4dde4d98c3fde10917aca07227872bbc5f5c2..e42b47ce4a5beaa21fb1cf5657ebbbccb4069665 100644
--- a/chrome/browser/guest_view/guest_view_base.h
+++ b/chrome/browser/guest_view/guest_view_base.h
@@ -103,6 +103,26 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
// This gives the derived class an opportunity to perform some cleanup.
virtual void GuestDestroyed() {}
+ // This method is invoked when the guest RenderView is ready, e.g. because we
+ // recreated it after a crash.
+ //
+ // This gives the derived class an opportunity to perform some initialization
+ // work.
+ virtual void GuestReady() {}
+
+ // This method is invoked when the contents auto-resized to give the container
+ // an opportunity to match it if it wishes.
+ //
+ // This gives the derived class an opportunity to inform its container element
+ // or perform other actions.
+ virtual void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
+ const gfx::Size& new_size) {}
+
+ // This method queries whether autosize is supported for this particular view.
+ // By default, autosize is not supported. Derived classes can override this
+ // behavior to support autosize.
+ virtual bool IsAutoSizeSupported() const;
+
// This method queries whether drag-and-drop is enabled for this particular
// view. By default, drag-and-drop is disabled. Derived classes can override
// this behavior to enable drag-and-drop.
@@ -154,6 +174,11 @@ 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);
+
base::WeakPtr<GuestViewBase> AsWeakPtr();
bool initialized() const { return initialized_; }
@@ -208,7 +233,11 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
// BrowserPluginGuestDelegate implementation.
virtual void Destroy() OVERRIDE FINAL;
virtual void DidAttach() OVERRIDE FINAL;
+ virtual void ElementSizeChanged(const gfx::Size& old_size,
+ const gfx::Size& new_size) OVERRIDE FINAL;
virtual int GetGuestInstanceID() const OVERRIDE;
+ virtual void GuestSizeChanged(const gfx::Size& old_size,
+ const gfx::Size& new_size) OVERRIDE FINAL;
virtual void RegisterDestructionCallback(
const DestructionCallback& callback) OVERRIDE FINAL;
virtual void WillAttach(
@@ -239,6 +268,7 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
// WebContentsObserver implementation.
virtual void DidStopLoading(
content::RenderViewHost* render_view_host) OVERRIDE FINAL;
+ virtual void RenderViewReady() OVERRIDE FINAL;
virtual void WebContentsDestroyed() OVERRIDE FINAL;
// WebContentsDelegate implementation.
@@ -277,6 +307,22 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_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_;
+
+ // Indicates whether autosize mode is enabled or not.
+ bool auto_size_enabled_;
+
+ // The maximum size constraints of the container element in autosize mode.
+ gfx::Size max_auto_size_;
+
+ // The minimum size constraints of the container element in autosize mode.
+ gfx::Size min_auto_size_;
+
// This is used to ensure pending tasks will not fire after this object is
// destroyed.
base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
« no previous file with comments | « chrome/browser/extensions/api/guest_view/guest_view_internal_api.cc ('k') | chrome/browser/guest_view/guest_view_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698