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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 8368016: Rebase BookmarkBubble on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add Textfield::[set_]select_all_on_focus, use GetInitiallyFocusedView. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 397 }
399 return NULL; 398 return NULL;
400 } 399 }
401 400
402 void LocationBarView::SetStarToggled(bool on) { 401 void LocationBarView::SetStarToggled(bool on) {
403 if (star_view_) 402 if (star_view_)
404 star_view_->SetToggled(on); 403 star_view_->SetToggled(on);
405 } 404 }
406 405
407 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { 406 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
408 gfx::Rect screen_bounds(star_view_->GetImageBounds());
409 // Compensate for some built-in padding in the Star image. 407 // Compensate for some built-in padding in the Star image.
410 screen_bounds.Inset(1, 1, 1, 2); 408 gfx::Point anchor(star_view_->width() / 2, star_view_->height() - 5);
411 gfx::Point origin(screen_bounds.origin()); 409 views::View::ConvertPointToScreen(star_view_, &anchor);
412 views::View::ConvertPointToScreen(star_view_, &origin); 410 browser::ShowBookmarkBubbleView(GetWidget(), anchor, browser_->profile(),
413 screen_bounds.set_origin(origin); 411 url, newly_bookmarked);
414 browser::ShowBookmarkBubbleView(GetWidget(), screen_bounds, star_view_,
415 browser_->profile(), url, newly_bookmarked);
416 } 412 }
417 413
418 gfx::Point LocationBarView::GetLocationEntryOrigin() const { 414 gfx::Point LocationBarView::GetLocationEntryOrigin() const {
419 gfx::Point origin(location_entry_view_->bounds().origin()); 415 gfx::Point origin(location_entry_view_->bounds().origin());
420 // If the UI layout is RTL, the coordinate system is not transformed and 416 // If the UI layout is RTL, the coordinate system is not transformed and
421 // therefore we need to adjust the X coordinate so that bubble appears on the 417 // therefore we need to adjust the X coordinate so that bubble appears on the
422 // right hand side of the location bar. 418 // right hand side of the location bar.
423 if (base::i18n::IsRTL()) 419 if (base::i18n::IsRTL())
424 origin.set_x(width() - origin.x()); 420 origin.set_x(width() - origin.x());
425 views::View::ConvertPointToScreen(this, &origin); 421 views::View::ConvertPointToScreen(this, &origin);
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 !suggested_text_view_->GetText().empty(); 1271 !suggested_text_view_->GetText().empty();
1276 } 1272 }
1277 1273
1278 #if !defined(USE_AURA) 1274 #if !defined(USE_AURA)
1279 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1275 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1280 CHECK(!views::Widget::IsPureViews()); 1276 CHECK(!views::Widget::IsPureViews());
1281 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1277 return static_cast<OmniboxViewWin*>(location_entry_.get());
1282 } 1278 }
1283 #endif 1279 #endif
1284 #endif 1280 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698