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

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 30814edc9cd0ff268aac72737f187f5a1c461253..0e20ee738aec1cd396d72e2c4b3f488cb74f73ee 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
@@ -1021,14 +1024,15 @@ 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_height = std::max(height() - (kVerticalEdgeThickness * 2), 0);
msw 2011/11/03 20:25:38 Shouldn't the vertical position be in terms of the
alicet1 2011/11/04 22:37:36 I remembered trying that and the bubble was positi
+ const int kXOffset = ResourceBundle::GetSharedInstance().GetBitmapNamed(
msw 2011/11/03 20:25:38 Shouldn't this be simply getting the middle of the
+ IDR_OMNIBOX_HTTP)->width() / 2;
+ gfx::Point origin(location_icon_view_->bounds().x() + kXOffset,
msw 2011/11/03 20:25:38 you can just call x() on the view.
+ location_height - 1);
msw 2011/11/03 20:25:38 Why '- 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.
@@ -1037,7 +1041,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