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

Unified Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 5254007: Addition of 'maxSize' to experimental popup extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/ui/views/extensions/extension_popup.cc
===================================================================
--- chrome/browser/ui/views/extensions/extension_popup.cc (revision 67311)
+++ chrome/browser/ui/views/extensions/extension_popup.cc (working copy)
@@ -34,9 +34,10 @@
using views::Widget;
-// The minimum/maximum dimensions of the popup.
+// The minimum, and default maximum dimensions of the popup.
// The minimum is just a little larger than the size of the button itself.
-// The maximum is an arbitrary number that should be smaller than most screens.
+// The default maximum is an arbitrary number that should be smaller than most
+// screens.
const int ExtensionPopup::kMinWidth = 25;
const int ExtensionPopup::kMinHeight = 25;
const int ExtensionPopup::kMaxWidth = 800;
@@ -76,6 +77,7 @@
border_(NULL),
border_view_(NULL),
popup_chrome_(chrome),
+ max_size_(kMaxWidth, kMaxHeight),
observer_(observer),
anchor_position_(arrow_location),
instance_lifetime_(new InternalRefCounter()){
@@ -289,9 +291,10 @@
void ExtensionPopup::OnExtensionPreferredSizeChanged(ExtensionView* view) {
// Constrain the size to popup min/max.
gfx::Size sz = view->GetPreferredSize();
+
view->SetBounds(view->x(), view->y(),
- std::max(kMinWidth, std::min(kMaxWidth, sz.width())),
- std::max(kMinHeight, std::min(kMaxHeight, sz.height())));
+ std::max(kMinWidth, std::min(max_size_.width(), sz.width())),
+ std::max(kMinHeight, std::min(max_size_.height(), sz.height())));
// If popup_chrome_ == RECTANGLE_CHROME, the border is drawn in the client
// area of the ExtensionView, rather than in a window which sits behind it.
@@ -387,6 +390,9 @@
inspect_with_devtools, chrome,
observer);
+ if (observer)
+ observer->ExtensionPopupCreated(popup);
+
// If the host had somehow finished loading, then we'd miss the notification
// and not show. This seems to happen in single-process mode.
if (host->did_stop_loading())

Powered by Google App Engine
This is Rietveld 408576698