Change the maximum bounds of the extension popup to be dynamic
This CL makes the maximum bounds of the extension popup dependent on
the screen boundaries. When enough screen space is not available and the
contained web view is large enough to occupy current maximum of 800x600,
the popup will now resize to the available space instead of getting
truncated.
Test:
1. On Windows 10, install an extension with a large popup and change
Settings > Ease of Access > Display > "Make text bigger" to 200%. The
popup should display in the available screen space and should not be
truncated.
2. Run BrowserActionPopup test on Windows & Mac at different scaling
settings.
Bug: 1123563
Change-Id: I8234df09936d4304e1c00f59c37457ca97e5a215
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2398072
Commit-Queue: Sanchit Abrol <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Devlin <[email protected]>
Reviewed-by: Peter Boström <[email protected]>
Reviewed-by: Elly Fong-Jones <[email protected]>
Cr-Commit-Position: refs/heads/master@{#824462}
diff --git a/chrome/browser/ui/extensions/extension_action_test_helper.h b/chrome/browser/ui/extensions/extension_action_test_helper.h
index e689ef7..b4ba9388 100644
--- a/chrome/browser/ui/extensions/extension_action_test_helper.h
+++ b/chrome/browser/ui/extensions/extension_action_test_helper.h
@@ -86,6 +86,9 @@
// Returns the associated ExtensionsContainer.
virtual ExtensionsContainer* GetExtensionsContainer() = 0;
+ // Waits for the ExtensionContainer's layout to be done.
+ virtual void WaitForExtensionsContainerLayout() = 0;
+
// Creates and returns a ExtensionActionTestHelper with an "overflow"
// container, with this object's container as the main bar.
virtual std::unique_ptr<ExtensionActionTestHelper> CreateOverflowBar(
@@ -104,6 +107,11 @@
// Returns the maximum allowed size of an extension popup.
virtual gfx::Size GetMaxPopupSize() = 0;
+ // Returns the maximum available size to place a bubble anchored to
+ // the browser action at |action_index| on screen.
+ virtual gfx::Size GetMaxAvailableSizeToFitBubbleOnScreen(
+ int action_index) = 0;
+
protected:
ExtensionActionTestHelper() {}