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

Unified Diff: chrome/browser/extensions/extension_view.cc

Issue 56122: Callbacks through ChromeClient->RenderView->RenderViewHost for ContentsDidCha... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « chrome/browser/extensions/extension_view.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_view.cc
===================================================================
--- chrome/browser/extensions/extension_view.cc (revision 13128)
+++ chrome/browser/extensions/extension_view.cc (working copy)
@@ -19,10 +19,40 @@
: HWNDHtmlView(url, this, false),
extension_(extension),
profile_(profile) {
- // TODO(mpcomplete): query this from the renderer somehow?
- set_preferred_size(gfx::Size(100, 100));
+ // Set the width initially to 0, so that the WebCore::Document can
+ // correctly compute the minPrefWidth which is returned in
+ // DidContentsChangeSize()
+ set_preferred_size(gfx::Size(0, 100));
+ SetVisible(false);
}
+void ExtensionView::DidStopLoading(RenderViewHost* render_view_host,
+ int32 page_id) {
+ SetVisible(true);
+ render_view_host->WasResized();
+}
+
+void ExtensionView::DidContentsPreferredWidthChange(const int pref_width) {
+ if (pref_width > 0) {
+ // SchedulePaint first because new_width may be smaller and we want
+ // the Parent to paint the vacated space.
+ SchedulePaint();
+ set_preferred_size(gfx::Size(pref_width, 100));
+ SizeToPreferredSize();
+
+ // TODO(rafaelw): This assumes that the extension view is a child of an
+ // ExtensionToolstrip, which is a child of the BookmarkBarView. There should
+ // be a way to do this where the ExtensionView doesn't have to know it's
+ // containment hierarchy.
+ if (GetParent() != NULL && GetParent()->GetParent() != NULL) {
+ GetParent()->GetParent()->Layout();
+ }
+
+ SchedulePaint();
+ render_view_host()->WasResized();
+ }
+}
+
void ExtensionView::CreatingRenderer() {
render_view_host()->AllowExtensionBindings();
}
« no previous file with comments | « chrome/browser/extensions/extension_view.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698