Commit ecd45aaa authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui extensions: fix anchor point

During the refactors in r723559 and prior two bugs crept in:

1) HasOmniboxKeyword() became inverted so that it returned true if there
   was *no* omnibox keyword (oops)
2) ShouldAnchorToOmnibox() came to mean "has omnibox keyword" rather
   than "has omnibox keyword *and* shouldn't anchor to browser/page
   action", which is what the old code had (oops again)

This change fixes both of those errors.

Bug: 1033856
Change-Id: I3c7a1a24d223b1893b4945a0aff6c79bc49c3ebc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1966360
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726409}
parent f65d9f4f
...@@ -98,10 +98,14 @@ bool ShouldAnchorToAction(const extensions::Extension* extension) { ...@@ -98,10 +98,14 @@ bool ShouldAnchorToAction(const extensions::Extension* extension) {
} }
} }
bool ShouldAnchorToOmnibox(const extensions::Extension* extension) { bool HasOmniboxKeyword(const Extension* extension) {
return !extensions::OmniboxInfo::GetKeyword(extension).empty(); return !extensions::OmniboxInfo::GetKeyword(extension).empty();
} }
bool ShouldAnchorToOmnibox(const extensions::Extension* extension) {
return !ShouldAnchorToAction(extension) && HasOmniboxKeyword(extension);
}
views::View* AnchorViewForBrowser(const extensions::Extension* extension, views::View* AnchorViewForBrowser(const extensions::Extension* extension,
Browser* browser) { Browser* browser) {
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
...@@ -165,10 +169,6 @@ gfx::ImageSkia MakeIconFromBitmap(const SkBitmap& bitmap) { ...@@ -165,10 +169,6 @@ gfx::ImageSkia MakeIconFromBitmap(const SkBitmap& bitmap) {
skia::ImageOperations::RESIZE_BEST, size); skia::ImageOperations::RESIZE_BEST, size);
} }
bool HasOmniboxKeyword(const Extension* extension) {
return extensions::OmniboxInfo::GetKeyword(extension).empty();
}
bool ShouldShowHowToUse(const extensions::Extension* extension) { bool ShouldShowHowToUse(const extensions::Extension* extension) {
const auto* info = GetActionInfoForExtension(extension); const auto* info = GetActionInfoForExtension(extension);
...@@ -334,7 +334,7 @@ ExtensionInstalledBubbleView::ExtensionInstalledBubbleView( ...@@ -334,7 +334,7 @@ ExtensionInstalledBubbleView::ExtensionInstalledBubbleView(
scoped_refptr<const extensions::Extension> extension, scoped_refptr<const extensions::Extension> extension,
const SkBitmap& icon) const SkBitmap& icon)
: BubbleDialogDelegateView(nullptr, : BubbleDialogDelegateView(nullptr,
HasOmniboxKeyword(extension.get()) ShouldAnchorToOmnibox(extension.get())
? views::BubbleBorder::TOP_LEFT ? views::BubbleBorder::TOP_LEFT
: views::BubbleBorder::TOP_RIGHT), : views::BubbleBorder::TOP_RIGHT),
bubble_reference_(bubble_reference), bubble_reference_(bubble_reference),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment