diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-29 16:39:00 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-29 16:39:00 +0000 |
commit | cf7e0777048a9cb4b8201d691a20a24f40a0d6b7 (patch) | |
tree | c49810f86c8dc51ae0b4792ef7adbd3eee399b26 /chrome/browser/cocoa/location_bar | |
parent | 14b1dcf8394568741696ede47bc1809f773eb942 (diff) | |
download | chromium_src-cf7e0777048a9cb4b8201d691a20a24f40a0d6b7.zip chromium_src-cf7e0777048a9cb4b8201d691a20a24f40a0d6b7.tar.gz chromium_src-cf7e0777048a9cb4b8201d691a20a24f40a0d6b7.tar.bz2 |
Fix positioning of first run bubble.
BUG=60576
TEST= trigger first run bubble by running Chrome with --first-run on an empty profile. Note that bubble points to a spot just to the right of the magnifying glass icon, where the user would begin typing a search term.
Review URL: http://codereview.chromium.org/4143008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/location_bar')
-rw-r--r-- | chrome/browser/cocoa/location_bar/location_bar_view_mac.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/location_bar/location_bar_view_mac.mm | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar/location_bar_view_mac.h index 583925d..b24e951 100644 --- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.h @@ -94,6 +94,9 @@ class LocationBarViewMac : public AutocompleteEditController, // Get the point in the security icon at which the page info bubble aims. NSPoint GetPageInfoBubblePoint() const; + // Get the point in the omnibox at which the first run bubble aims. + NSPoint GetFirstRunBubblePoint() const; + // Updates the location bar. Resets the bar's permanent text and // security style, and if |should_restore_state| is true, restores // saved state from the tab (for tab switching). diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm index 9b45531..82791c2 100644 --- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm @@ -56,6 +56,17 @@ #include "skia/ext/skia_utils_mac.h" #include "third_party/skia/include/core/SkBitmap.h" +namespace { + +// Horizontal space between the right edge of the |location_icon_decoration_| +// and the first run bubble arrow point. +const static int kFirstRunBubbleXOffset = 4; + +// Vertical space between the bottom edge of the location_bar and the first run +// bubble arrow point. +const static int kFirstRunBubbleYOffset = 1; + +} // TODO(shess): This code is mostly copied from the gtk // implementation. Make sure it's all appropriate and flesh it out. @@ -119,7 +130,7 @@ void LocationBarViewMac::ShowFirstRunBubbleInternal( // The bubble needs to be just below the Omnibox and slightly to the right // of the left omnibox icon, so shift x and y co-ordinates. - const NSPoint kOffset = NSMakePoint(1, 4); + const NSPoint kOffset = GetFirstRunBubblePoint(); [FirstRunBubbleController showForView:field_ offset:kOffset profile:profile_]; } @@ -489,6 +500,16 @@ NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { } } +NSPoint LocationBarViewMac::GetFirstRunBubblePoint() const { + AutocompleteTextFieldCell* cell = [field_ cell]; + const NSRect frame = + [cell frameForDecoration:location_icon_decoration_.get() + inFrame:[field_ bounds]]; + return NSMakePoint( + NSMaxX(frame) + kFirstRunBubbleXOffset, + kFirstRunBubbleYOffset); +} + NSImage* LocationBarViewMac::GetKeywordImage(const std::wstring& keyword) { const TemplateURL* template_url = profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); |