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

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

Issue 3041045: Merge 54839 - [Mac] Adjust browser-action and content-setting popup points... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: 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
« no previous file with comments | « chrome/browser/cocoa/location_bar/content_setting_decoration.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/location_bar/content_setting_decoration.mm
===================================================================
--- chrome/browser/cocoa/location_bar/content_setting_decoration.mm (revision 54844)
+++ chrome/browser/cocoa/location_bar/content_setting_decoration.mm (working copy)
@@ -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 @@
}
}
+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 @@
// 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];
« no previous file with comments | « chrome/browser/cocoa/location_bar/content_setting_decoration.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698