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

Unified Diff: chrome/browser/cocoa/location_bar/content_setting_decoration.mm

Issue 3054040: [Mac] Adjust browser-action and content-setting popup points (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Merge to LKGR. Created 10 years, 5 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/cocoa/location_bar/content_setting_decoration.mm
diff --git a/chrome/browser/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/cocoa/location_bar/content_setting_decoration.mm
index 6f2b8a3935406a8af5a6bb263c88be5fabb425f7..790b5c21ece4d177009c0cb75ff3b98df2eb51d9 100644
--- a/chrome/browser/cocoa/location_bar/content_setting_decoration.mm
+++ b/chrome/browser/cocoa/location_bar/content_setting_decoration.mm
@@ -17,6 +17,14 @@
#include "chrome/common/pref_names.h"
#include "net/base/net_util.h"
+namespace {
+
+// How far to offset up from the bottom of the view to get the top
+// border of the popup 2px below the bottom of the Omnibox.
+const CGFloat kPopupPointYOffset = 2.0;
+
+} // namespace
+
ContentSettingDecoration::ContentSettingDecoration(
ContentSettingsType settings_type,
LocationBarViewMac* owner,
@@ -45,6 +53,12 @@ void ContentSettingDecoration::UpdateFromTabContents(
}
}
+NSPoint ContentSettingDecoration::GetBubblePointInFrame(NSRect frame) {
+ const NSRect draw_frame = GetDrawRectInFrame(frame);
+ return NSMakePoint(NSMidX(draw_frame),
+ NSMaxY(draw_frame) - kPopupPointYOffset);
+}
+
bool ContentSettingDecoration::OnMousePressed(NSRect frame) {
// Get host. This should be shared on linux/win/osx medium-term.
TabContents* tabContents =
@@ -61,10 +75,11 @@ bool ContentSettingDecoration::OnMousePressed(NSRect frame) {
// Find point for bubble's arrow in screen coordinates.
// TODO(shess): |owner_| is only being used to fetch |field|.
- // Consider passing in |control_view|.
+ // Consider passing in |control_view|. Or refactoring to be
+ // consistent with other decorations (which don't currently bring up
+ // their bubble directly).
AutocompleteTextField* field = owner_->GetAutocompleteTextField();
- frame = GetDrawRectInFrame(frame);
- NSPoint anchor = NSMakePoint(NSMidX(frame) + 1, NSMaxY(frame));
+ NSPoint anchor = GetBubblePointInFrame(frame);
anchor = [field convertPoint:anchor toView:nil];
anchor = [[field window] convertBaseToScreen:anchor];

Powered by Google App Engine
This is Rietveld 408576698