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

Side by Side 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 chrome_tests.gypi 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/controls/label.h" 59 #include "views/controls/label.h"
60 #include "views/controls/textfield/native_textfield_views.h" 60 #include "views/controls/textfield/native_textfield_views.h"
61 #include "views/drag_utils.h" 61 #include "views/drag_utils.h"
62 62
63 #if defined(OS_WIN) 63 #if !defined(OS_CHROMEOS)
64 #include "chrome/browser/ui/views/first_run_bubble.h" 64 #include "chrome/browser/ui/views/first_run_bubble.h"
65 #endif 65 #endif
66 66
67 #if defined(OS_WIN) || defined(USE_AURA) 67 #if defined(OS_WIN) || defined(USE_AURA)
68 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" 68 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h"
69 #endif 69 #endif
70 70
71 using views::View; 71 using views::View;
72 72
73 namespace { 73 namespace {
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 ConvertPointToScreen(this, &screen_point); 980 ConvertPointToScreen(this, &screen_point);
981 if (views::Widget::IsPureViews()) 981 if (views::Widget::IsPureViews())
982 NOTIMPLEMENTED(); 982 NOTIMPLEMENTED();
983 else 983 else
984 GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); 984 GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT());
985 } 985 }
986 #endif 986 #endif
987 987
988 void LocationBarView::ShowFirstRunBubbleInternal( 988 void LocationBarView::ShowFirstRunBubbleInternal(
989 FirstRun::BubbleType bubble_type) { 989 FirstRun::BubbleType bubble_type) {
990 #if defined(OS_WIN) // First run bubble doesn't make sense for Chrome OS. 990 #if !defined(OS_CHROMEOS)
991 // Point at the start of the edit control; adjust to look as good as possible. 991 // First run bubble doesn't make sense for Chrome OS.
992 const int kXOffset = kNormalHorizontalEdgeThickness + kEdgeItemPadding + 992 FirstRunBubble::ShowBubble(browser_->profile(),
993 ResourceBundle::GetSharedInstance().GetBitmapNamed( 993 location_icon_view_,
994 IDR_OMNIBOX_HTTP)->width() + kItemPadding; 994 views::BubbleBorder::TOP_LEFT,
995 const int kYOffset = -(kVerticalEdgeThickness + 2); 995 bubble_type);
996 gfx::Point origin(location_entry_view_->bounds().x() + kXOffset,
997 y() + height() + kYOffset);
998 // If the UI layout is RTL, the coordinate system is not transformed and
999 // therefore we need to adjust the X coordinate so that bubble appears on the
1000 // right hand side of the location bar.
1001 if (base::i18n::IsRTL())
1002 origin.set_x(width() - origin.x());
1003 views::View::ConvertPointToScreen(this, &origin);
1004 FirstRunBubble::Show(browser_->profile(), GetWidget(),
1005 gfx::Rect(origin, gfx::Size()),
1006 views::BubbleBorder::TOP_LEFT, bubble_type);
1007 #endif 996 #endif
1008 } 997 }
1009 998
1010 std::string LocationBarView::GetClassName() const { 999 std::string LocationBarView::GetClassName() const {
1011 return kViewClassName; 1000 return kViewClassName;
1012 } 1001 }
1013 1002
1014 bool LocationBarView::SkipDefaultKeyEventProcessing( 1003 bool LocationBarView::SkipDefaultKeyEventProcessing(
1015 const views::KeyEvent& event) { 1004 const views::KeyEvent& event) {
1016 #if defined(OS_WIN) 1005 #if defined(OS_WIN)
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 !suggested_text_view_->GetText().empty(); 1229 !suggested_text_view_->GetText().empty();
1241 } 1230 }
1242 1231
1243 #if !defined(USE_AURA) 1232 #if !defined(USE_AURA)
1244 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1233 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1245 CHECK(!views::Widget::IsPureViews()); 1234 CHECK(!views::Widget::IsPureViews());
1246 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1235 return static_cast<OmniboxViewWin*>(location_entry_.get());
1247 } 1236 }
1248 #endif 1237 #endif
1249 #endif 1238 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/first_run_bubble_unittest.cc ('k') | chrome/browser/ui/views/stubs_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698