OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "grit/theme_resources_standard.h" | 49 #include "grit/theme_resources_standard.h" |
50 #include "ui/base/accessibility/accessible_view_state.h" | 50 #include "ui/base/accessibility/accessible_view_state.h" |
51 #include "ui/base/dragdrop/drag_drop_types.h" | 51 #include "ui/base/dragdrop/drag_drop_types.h" |
52 #include "ui/base/l10n/l10n_util.h" | 52 #include "ui/base/l10n/l10n_util.h" |
53 #include "ui/base/resource/resource_bundle.h" | 53 #include "ui/base/resource/resource_bundle.h" |
54 #include "ui/base/theme_provider.h" | 54 #include "ui/base/theme_provider.h" |
55 #include "ui/gfx/canvas_skia.h" | 55 #include "ui/gfx/canvas_skia.h" |
56 #include "ui/gfx/color_utils.h" | 56 #include "ui/gfx/color_utils.h" |
57 #include "ui/gfx/image/image.h" | 57 #include "ui/gfx/image/image.h" |
58 #include "ui/gfx/skia_util.h" | 58 #include "ui/gfx/skia_util.h" |
59 #include "views/bubble/bubble_border.h" | |
60 #include "views/controls/label.h" | 59 #include "views/controls/label.h" |
61 #include "views/controls/textfield/native_textfield_views.h" | 60 #include "views/controls/textfield/native_textfield_views.h" |
62 #include "views/drag_utils.h" | 61 #include "views/drag_utils.h" |
63 | 62 |
64 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
65 #include "chrome/browser/ui/views/first_run_bubble.h" | 64 #include "chrome/browser/ui/views/first_run_bubble.h" |
66 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" | 65 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" |
67 #endif | 66 #endif |
68 | 67 |
69 using views::View; | 68 using views::View; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 384 } |
386 return NULL; | 385 return NULL; |
387 } | 386 } |
388 | 387 |
389 void LocationBarView::SetStarToggled(bool on) { | 388 void LocationBarView::SetStarToggled(bool on) { |
390 if (star_view_) | 389 if (star_view_) |
391 star_view_->SetToggled(on); | 390 star_view_->SetToggled(on); |
392 } | 391 } |
393 | 392 |
394 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 393 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
395 gfx::Rect screen_bounds(star_view_->GetImageBounds()); | 394 browser::ShowBookmarkBubbleView(star_view_, browser_->profile(), url, |
396 // Compensate for some built-in padding in the Star image. | 395 newly_bookmarked); |
397 screen_bounds.Inset(1, 1, 1, 2); | |
398 gfx::Point origin(screen_bounds.origin()); | |
399 views::View::ConvertPointToScreen(star_view_, &origin); | |
400 screen_bounds.set_origin(origin); | |
401 browser::ShowBookmarkBubbleView(GetWidget(), screen_bounds, star_view_, | |
402 browser_->profile(), url, newly_bookmarked); | |
403 } | 396 } |
404 | 397 |
405 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 398 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
406 gfx::Point origin(location_entry_view_->bounds().origin()); | 399 gfx::Point origin(location_entry_view_->bounds().origin()); |
407 // If the UI layout is RTL, the coordinate system is not transformed and | 400 // If the UI layout is RTL, the coordinate system is not transformed and |
408 // therefore we need to adjust the X coordinate so that bubble appears on the | 401 // therefore we need to adjust the X coordinate so that bubble appears on the |
409 // right hand side of the location bar. | 402 // right hand side of the location bar. |
410 if (base::i18n::IsRTL()) | 403 if (base::i18n::IsRTL()) |
411 origin.set_x(width() - origin.x()); | 404 origin.set_x(width() - origin.x()); |
412 views::View::ConvertPointToScreen(this, &origin); | 405 views::View::ConvertPointToScreen(this, &origin); |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 !suggested_text_view_->GetText().empty(); | 1238 !suggested_text_view_->GetText().empty(); |
1246 } | 1239 } |
1247 | 1240 |
1248 #if !defined(USE_AURA) | 1241 #if !defined(USE_AURA) |
1249 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1242 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
1250 CHECK(!views::Widget::IsPureViews()); | 1243 CHECK(!views::Widget::IsPureViews()); |
1251 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1244 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
1252 } | 1245 } |
1253 #endif | 1246 #endif |
1254 #endif | 1247 #endif |
OLD | NEW |