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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 8265005: first run bubble using the views/bubble api. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update. Created 9 years, 1 month 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/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index e0c2d6b7425c211d09804357c7fba5c639953d2e..b1f95cd60bca7327d87ffd46ff1f48e9a2f02000 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -61,8 +61,11 @@
#include "views/controls/textfield/native_textfield_views.h"
#include "views/drag_utils.h"
-#if defined(OS_WIN)
+#if !defined(OS_CHROMEOS)
#include "chrome/browser/ui/views/first_run_bubble.h"
+#endif
+
+#if defined(OS_WIN)
#include "chrome/browser/ui/views/location_bar/suggested_text_view.h"
#endif
@@ -405,6 +408,8 @@ void LocationBarView::SetStarToggled(bool on) {
}
void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
+ ShowFirstRunBubble(FirstRun::OEM_BUBBLE);
+#ifdef NEVER
gfx::Rect screen_bounds(star_view_->GetImageBounds());
// Compensate for some built-in padding in the Star image.
screen_bounds.Inset(1, 1, 1, 2);
@@ -413,6 +418,7 @@ void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
screen_bounds.set_origin(origin);
browser::ShowBookmarkBubbleView(GetWidget(), screen_bounds, star_view_,
browser_->profile(), url, newly_bookmarked);
+#endif
}
gfx::Point LocationBarView::GetLocationEntryOrigin() const {
@@ -1022,14 +1028,17 @@ void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) {
void LocationBarView::ShowFirstRunBubbleInternal(
FirstRun::BubbleType bubble_type) {
-#if defined(OS_WIN) // First run bubble doesn't make sense for Chrome OS.
- // Point at the start of the edit control; adjust to look as good as possible.
- const int kXOffset = kNormalHorizontalEdgeThickness + kEdgeItemPadding +
- ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_OMNIBOX_HTTP)->width() + kItemPadding;
- const int kYOffset = -(kVerticalEdgeThickness + 2);
- gfx::Point origin(location_entry_view_->bounds().x() + kXOffset,
- y() + height() + kYOffset);
+ // TODO(alicet): clean up all |bubble_type| reference in the codebase.
+#if !defined(OS_CHROMEOS)
+ // First run bubble doesn't make sense for Chrome OS.
+ // Point at the omnibox icon.
+ // int location_y = kVerticalEdgeThickness;
Miranda Callahan 2011/11/02 15:36:14 remove commented-out code.
alicet1 2011/11/03 18:21:51 Done.
+ int location_height = std::max(height() - (kVerticalEdgeThickness * 2), 0);
+ // const int kYOffset = -(kVerticalEdgeThickness * 2);
Miranda Callahan 2011/11/02 15:36:14 same as above.
alicet1 2011/11/03 18:21:51 Done.
+ const int kXOffset = ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_OMNIBOX_HTTP)->width() / 2;
+ gfx::Point origin(location_icon_view_->bounds().x() + kXOffset,
+ location_height - 1);
// If the UI layout is RTL, the coordinate system is not transformed and
// therefore we need to adjust the X coordinate so that bubble appears on the
// right hand side of the location bar.
@@ -1038,7 +1047,7 @@ void LocationBarView::ShowFirstRunBubbleInternal(
views::View::ConvertPointToScreen(this, &origin);
FirstRunBubble::Show(browser_->profile(), GetWidget(),
gfx::Rect(origin, gfx::Size()),
- views::BubbleBorder::TOP_LEFT, bubble_type);
+ views::BubbleBorder::TOP_LEFT);
#endif
}

Powered by Google App Engine
This is Rietveld 408576698