OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 gfx::Rect screen_bounds(star_view_->GetImageBounds()); | 381 gfx::Rect screen_bounds(star_view_->GetImageBounds()); |
382 // Compensate for some built-in padding in the Star image. | 382 // Compensate for some built-in padding in the Star image. |
383 screen_bounds.Inset(1, 1, 1, 2); | 383 screen_bounds.Inset(1, 1, 1, 2); |
384 gfx::Point origin(screen_bounds.origin()); | 384 gfx::Point origin(screen_bounds.origin()); |
385 views::View::ConvertPointToScreen(star_view_, &origin); | 385 views::View::ConvertPointToScreen(star_view_, &origin); |
386 screen_bounds.set_origin(origin); | 386 screen_bounds.set_origin(origin); |
387 browser::ShowBookmarkBubbleView(GetWindow(), screen_bounds, star_view_, | 387 browser::ShowBookmarkBubbleView(GetWindow(), screen_bounds, star_view_, |
388 profile_, url, newly_bookmarked); | 388 profile_, url, newly_bookmarked); |
389 } | 389 } |
390 | 390 |
| 391 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
| 392 gfx::Point origin(location_entry_view_->bounds().origin()); |
| 393 // If the UI layout is RTL, the coordinate system is not transformed and |
| 394 // therefore we need to adjust the X coordinate so that bubble appears on the |
| 395 // right hand side of the location bar. |
| 396 if (base::i18n::IsRTL()) |
| 397 origin.set_x(width() - origin.x()); |
| 398 views::View::ConvertPointToScreen(this, &origin); |
| 399 return origin; |
| 400 } |
| 401 |
391 void LocationBarView::OnCommitSuggestedText() { | 402 void LocationBarView::OnCommitSuggestedText() { |
392 InstantController* instant = delegate_->GetInstant(); | 403 InstantController* instant = delegate_->GetInstant(); |
393 DCHECK(instant); | 404 DCHECK(instant); |
394 DCHECK(suggested_text_view_); | 405 DCHECK(suggested_text_view_); |
395 location_entry_->ReplaceSelection( | 406 location_entry_->ReplaceSelection( |
396 WideToUTF16(suggested_text_view_->GetText())); | 407 WideToUTF16(suggested_text_view_->GetText())); |
397 // TODO(sky): We need to route the suggestion through InstantController so it | 408 // TODO(sky): We need to route the suggestion through InstantController so it |
398 // doesn't fetch suggestions. | 409 // doesn't fetch suggestions. |
399 } | 410 } |
400 | 411 |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 } | 1223 } |
1213 | 1224 |
1214 NOTREACHED(); | 1225 NOTREACHED(); |
1215 } | 1226 } |
1216 | 1227 |
1217 void LocationBarView::OnTemplateURLModelChanged() { | 1228 void LocationBarView::OnTemplateURLModelChanged() { |
1218 template_url_model_->RemoveObserver(this); | 1229 template_url_model_->RemoveObserver(this); |
1219 template_url_model_ = NULL; | 1230 template_url_model_ = NULL; |
1220 ShowFirstRunBubble(bubble_type_); | 1231 ShowFirstRunBubble(bubble_type_); |
1221 } | 1232 } |
OLD | NEW |