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 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/ui/view_ids.h" | 28 #include "chrome/browser/ui/view_ids.h" |
29 #include "chrome/browser/ui/views/browser_dialogs.h" | 29 #include "chrome/browser/ui/views/browser_dialogs.h" |
30 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 30 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
31 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 31 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
32 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 32 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
33 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 33 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
34 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 34 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
35 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 35 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
36 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 36 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
37 #include "chrome/browser/ui/views/location_bar/star_view.h" | 37 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 38 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
40 #include "content/browser/renderer_host/render_widget_host_view.h" | 41 #include "content/browser/renderer_host/render_widget_host_view.h" |
41 #include "content/common/notification_service.h" | 42 #include "content/common/notification_service.h" |
42 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
43 #include "grit/theme_resources.h" | 44 #include "grit/theme_resources.h" |
44 #include "grit/theme_resources_standard.h" | 45 #include "grit/theme_resources_standard.h" |
45 #include "ui/base/accessibility/accessible_view_state.h" | 46 #include "ui/base/accessibility/accessible_view_state.h" |
46 #include "ui/base/dragdrop/drag_drop_types.h" | 47 #include "ui/base/dragdrop/drag_drop_types.h" |
47 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
48 #include "ui/base/resource/resource_bundle.h" | 49 #include "ui/base/resource/resource_bundle.h" |
49 #include "ui/base/theme_provider.h" | 50 #include "ui/base/theme_provider.h" |
50 #include "ui/gfx/canvas_skia.h" | 51 #include "ui/gfx/canvas_skia.h" |
51 #include "ui/gfx/color_utils.h" | 52 #include "ui/gfx/color_utils.h" |
52 #include "ui/gfx/skia_util.h" | 53 #include "ui/gfx/skia_util.h" |
53 #include "views/controls/label.h" | 54 #include "views/controls/label.h" |
| 55 #include "views/controls/textfield/native_textfield_views.h" |
54 #include "views/drag_utils.h" | 56 #include "views/drag_utils.h" |
55 | 57 |
56 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
57 #include "chrome/browser/ui/views/first_run_bubble.h" | 59 #include "chrome/browser/ui/views/first_run_bubble.h" |
58 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" | 60 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" |
59 #endif | 61 #endif |
60 | 62 |
61 using views::View; | 63 using views::View; |
62 | 64 |
63 namespace { | 65 namespace { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ev_bubble_view_ = | 166 ev_bubble_view_ = |
165 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, | 167 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, |
166 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), this); | 168 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), this); |
167 AddChildView(ev_bubble_view_); | 169 AddChildView(ev_bubble_view_); |
168 ev_bubble_view_->SetVisible(false); | 170 ev_bubble_view_->SetVisible(false); |
169 ev_bubble_view_->SetDragController(this); | 171 ev_bubble_view_->SetDragController(this); |
170 | 172 |
171 // URL edit field. | 173 // URL edit field. |
172 // View container for URL edit field. | 174 // View container for URL edit field. |
173 #if defined(OS_WIN) | 175 #if defined(OS_WIN) |
174 location_entry_.reset(new OmniboxViewWin(font_, this, model_, this, | 176 if (UseViewsOmnibox()) { |
175 GetWidget()->GetNativeView(), profile_, browser_->command_updater(), | 177 OmniboxViewViews* omnibox_view = |
176 mode_ == POPUP, this)); | 178 new OmniboxViewViews(this, model_, profile_, |
| 179 browser_->command_updater(), mode_ == POPUP, this); |
| 180 omnibox_view->Init(); |
| 181 location_entry_.reset(omnibox_view); |
| 182 } else { |
| 183 location_entry_.reset(new OmniboxViewWin(font_, this, model_, this, |
| 184 GetWidget()->GetNativeView(), profile_, browser_->command_updater(), |
| 185 mode_ == POPUP, this)); |
| 186 } |
177 #else | 187 #else |
178 location_entry_.reset(OmniboxViewGtk::Create(this, model_, profile_, | 188 location_entry_.reset(OmniboxViewGtk::Create(this, model_, profile_, |
179 browser_->command_updater(), mode_ == POPUP, this)); | 189 browser_->command_updater(), mode_ == POPUP, this)); |
180 #endif | 190 #endif |
181 | 191 |
182 location_entry_view_ = location_entry_->AddToView(this); | 192 location_entry_view_ = location_entry_->AddToView(this); |
183 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); | 193 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); |
184 | 194 |
185 selected_keyword_view_ = new SelectedKeywordView( | 195 selected_keyword_view_ = new SelectedKeywordView( |
186 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, | 196 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 bool animate_to_complete) { | 424 bool animate_to_complete) { |
415 // Don't show the suggested text if inline autocomplete is prevented. | 425 // Don't show the suggested text if inline autocomplete is prevented. |
416 if (!text.empty()) { | 426 if (!text.empty()) { |
417 if (!suggested_text_view_) { | 427 if (!suggested_text_view_) { |
418 suggested_text_view_ = new SuggestedTextView(location_entry_->model()); | 428 suggested_text_view_ = new SuggestedTextView(location_entry_->model()); |
419 suggested_text_view_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 429 suggested_text_view_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
420 suggested_text_view_->SetColor( | 430 suggested_text_view_->SetColor( |
421 GetColor(ToolbarModel::NONE, | 431 GetColor(ToolbarModel::NONE, |
422 LocationBarView::DEEMPHASIZED_TEXT)); | 432 LocationBarView::DEEMPHASIZED_TEXT)); |
423 suggested_text_view_->SetText(UTF16ToWide(text)); | 433 suggested_text_view_->SetText(UTF16ToWide(text)); |
424 suggested_text_view_->SetFont(location_entry_->GetFont()); | 434 if (UseViewsOmnibox()) |
| 435 NOTIMPLEMENTED(); |
| 436 else |
| 437 suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont()); |
425 AddChildView(suggested_text_view_); | 438 AddChildView(suggested_text_view_); |
426 } else if (suggested_text_view_->GetText() != UTF16ToWide(text)) { | 439 } else if (suggested_text_view_->GetText() != UTF16ToWide(text)) { |
427 suggested_text_view_->SetText(UTF16ToWide(text)); | 440 suggested_text_view_->SetText(UTF16ToWide(text)); |
428 } | 441 } |
429 if (animate_to_complete && !location_entry_->IsImeComposing()) | 442 if (animate_to_complete && !location_entry_->IsImeComposing()) |
430 suggested_text_view_->StartAnimation(); | 443 suggested_text_view_->StartAnimation(); |
431 } else if (suggested_text_view_) { | 444 } else if (suggested_text_view_) { |
432 delete suggested_text_view_; | 445 delete suggested_text_view_; |
433 suggested_text_view_ = NULL; | 446 suggested_text_view_ = NULL; |
434 } else { | 447 } else { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 static const int kMinElidedBubbleWidth = 150; | 539 static const int kMinElidedBubbleWidth = 150; |
527 static const double kMaxBubbleFraction = 0.5; | 540 static const double kMaxBubbleFraction = 0.5; |
528 const int total_padding = | 541 const int total_padding = |
529 kEdgeThickness + kBubbleHorizontalPadding + kItemEditPadding; | 542 kEdgeThickness + kBubbleHorizontalPadding + kItemEditPadding; |
530 ev_bubble_width = std::min(ev_bubble_width, std::max(kMinElidedBubbleWidth, | 543 ev_bubble_width = std::min(ev_bubble_width, std::max(kMinElidedBubbleWidth, |
531 static_cast<int>((entry_width - total_padding) * kMaxBubbleFraction))); | 544 static_cast<int>((entry_width - total_padding) * kMaxBubbleFraction))); |
532 entry_width -= (total_padding + ev_bubble_width); | 545 entry_width -= (total_padding + ev_bubble_width); |
533 } | 546 } |
534 | 547 |
535 #if defined(OS_WIN) | 548 #if defined(OS_WIN) |
536 RECT formatting_rect; | 549 int max_edit_width = entry_width; |
537 location_entry_->GetRect(&formatting_rect); | 550 if (UseViewsOmnibox()) { |
538 RECT edit_bounds; | 551 NOTIMPLEMENTED(); |
539 location_entry_->GetClientRect(&edit_bounds); | 552 } else { |
540 int max_edit_width = entry_width - formatting_rect.left - | 553 RECT formatting_rect; |
541 (edit_bounds.right - formatting_rect.right); | 554 GetOmniboxViewWin()->GetRect(&formatting_rect); |
| 555 RECT edit_bounds; |
| 556 GetOmniboxViewWin()->GetClientRect(&edit_bounds); |
| 557 max_edit_width = entry_width - formatting_rect.left - |
| 558 (edit_bounds.right - formatting_rect.right); |
| 559 } |
542 #else | 560 #else |
543 int max_edit_width = entry_width; | 561 int max_edit_width = entry_width; |
544 #endif | 562 #endif |
545 | 563 |
546 if (max_edit_width < 0) | 564 if (max_edit_width < 0) |
547 return; | 565 return; |
548 const int available_width = AvailableWidth(max_edit_width); | 566 const int available_width = AvailableWidth(max_edit_width); |
549 | 567 |
550 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; | 568 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; |
551 selected_keyword_view_->SetVisible(show_selected_keyword); | 569 selected_keyword_view_->SetVisible(show_selected_keyword); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 // entry. Only show the suggested text if we can fit the text from one | 668 // entry. Only show the suggested text if we can fit the text from one |
651 // character before the end of the selection to the end of the text and the | 669 // character before the end of the selection to the end of the text and the |
652 // suggested text. If we can't it means either the suggested text is too big, | 670 // suggested text. If we can't it means either the suggested text is too big, |
653 // or the user has scrolled. | 671 // or the user has scrolled. |
654 | 672 |
655 // TODO(sky): We could potentially combine this with the previous step to | 673 // TODO(sky): We could potentially combine this with the previous step to |
656 // force using minimum size if necessary, but currently the chance of showing | 674 // force using minimum size if necessary, but currently the chance of showing |
657 // keyword hints and suggested text is minimal and we're not confident this | 675 // keyword hints and suggested text is minimal and we're not confident this |
658 // is the right approach for suggested text. | 676 // is the right approach for suggested text. |
659 if (suggested_text_view_) { | 677 if (suggested_text_view_) { |
660 // TODO(sky): need to layout when the user changes caret position. | 678 if (UseViewsOmnibox()) { |
661 int suggested_text_width = suggested_text_view_->GetPreferredSize().width(); | 679 NOTIMPLEMENTED(); |
662 int vis_text_width = location_entry_->WidthOfTextAfterCursor(); | |
663 if (vis_text_width + suggested_text_width > entry_width) { | |
664 // Hide the suggested text if the user has scrolled or we can't fit all | |
665 // the suggested text. | |
666 suggested_text_view_->SetBounds(0, 0, 0, 0); | |
667 } else { | 680 } else { |
668 int location_needed_width = location_entry_->TextWidth(); | 681 // TODO(sky): need to layout when the user changes caret position. |
669 location_bounds.set_width(std::min(location_needed_width, | 682 int suggested_text_width = |
670 entry_width - suggested_text_width)); | 683 suggested_text_view_->GetPreferredSize().width(); |
671 // TODO(sky): figure out why this needs the -1. | 684 int vis_text_width = GetOmniboxViewWin()->WidthOfTextAfterCursor(); |
672 suggested_text_view_->SetBounds(location_bounds.right() - 1, | 685 if (vis_text_width + suggested_text_width > entry_width) { |
673 location_bounds.y(), | 686 // Hide the suggested text if the user has scrolled or we can't fit all |
674 suggested_text_width, | 687 // the suggested text. |
675 location_bounds.height()); | 688 suggested_text_view_->SetBounds(0, 0, 0, 0); |
| 689 } else { |
| 690 int location_needed_width = location_entry_->TextWidth(); |
| 691 location_bounds.set_width(std::min(location_needed_width, |
| 692 entry_width - suggested_text_width)); |
| 693 // TODO(sky): figure out why this needs the -1. |
| 694 suggested_text_view_->SetBounds(location_bounds.right() - 1, |
| 695 location_bounds.y(), |
| 696 suggested_text_width, |
| 697 location_bounds.height()); |
| 698 } |
676 } | 699 } |
677 } | 700 } |
678 #endif | 701 #endif |
679 | 702 |
680 location_entry_view_->SetBoundsRect(location_bounds); | 703 location_entry_view_->SetBoundsRect(location_bounds); |
681 } | 704 } |
682 | 705 |
683 void LocationBarView::OnPaint(gfx::Canvas* canvas) { | 706 void LocationBarView::OnPaint(gfx::Canvas* canvas) { |
684 View::OnPaint(canvas); | 707 View::OnPaint(canvas); |
685 | 708 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 } else if (event.IsRightMouseButton()) { | 794 } else if (event.IsRightMouseButton()) { |
772 msg = WM_RBUTTONUP; | 795 msg = WM_RBUTTONUP; |
773 } else { | 796 } else { |
774 NOTREACHED(); | 797 NOTREACHED(); |
775 return; | 798 return; |
776 } | 799 } |
777 OnMouseEvent(event, msg); | 800 OnMouseEvent(event, msg); |
778 } | 801 } |
779 | 802 |
780 void LocationBarView::OnMouseCaptureLost() { | 803 void LocationBarView::OnMouseCaptureLost() { |
781 location_entry_->HandleExternalMsg(WM_CAPTURECHANGED, 0, CPoint()); | 804 if (UseViewsOmnibox()) |
| 805 NOTIMPLEMENTED(); |
| 806 else |
| 807 GetOmniboxViewWin()->HandleExternalMsg(WM_CAPTURECHANGED, 0, CPoint()); |
782 } | 808 } |
783 #endif | 809 #endif |
784 | 810 |
785 void LocationBarView::OnAutocompleteAccept( | 811 void LocationBarView::OnAutocompleteAccept( |
786 const GURL& url, | 812 const GURL& url, |
787 WindowOpenDisposition disposition, | 813 WindowOpenDisposition disposition, |
788 PageTransition::Type transition, | 814 PageTransition::Type transition, |
789 const GURL& alternate_nav_url) { | 815 const GURL& alternate_nav_url) { |
790 // WARNING: don't add an early return here. The calls after the if must | 816 // WARNING: don't add an early return here. The calls after the if must |
791 // happen. | 817 // happen. |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 } | 990 } |
965 } | 991 } |
966 } | 992 } |
967 } | 993 } |
968 | 994 |
969 #if defined(OS_WIN) | 995 #if defined(OS_WIN) |
970 void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) { | 996 void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) { |
971 UINT flags = event.GetWindowsFlags(); | 997 UINT flags = event.GetWindowsFlags(); |
972 gfx::Point screen_point(event.location()); | 998 gfx::Point screen_point(event.location()); |
973 ConvertPointToScreen(this, &screen_point); | 999 ConvertPointToScreen(this, &screen_point); |
974 location_entry_->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); | 1000 if (UseViewsOmnibox()) |
| 1001 NOTIMPLEMENTED(); |
| 1002 else |
| 1003 GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); |
975 } | 1004 } |
976 #endif | 1005 #endif |
977 | 1006 |
978 void LocationBarView::ShowFirstRunBubbleInternal( | 1007 void LocationBarView::ShowFirstRunBubbleInternal( |
979 FirstRun::BubbleType bubble_type) { | 1008 FirstRun::BubbleType bubble_type) { |
980 #if defined(OS_WIN) // First run bubble doesn't make sense for Chrome OS. | 1009 #if defined(OS_WIN) // First run bubble doesn't make sense for Chrome OS. |
981 // Point at the start of the edit control; adjust to look as good as possible. | 1010 // Point at the start of the edit control; adjust to look as good as possible. |
982 const int kXOffset = kNormalHorizontalEdgeThickness + kEdgeItemPadding + | 1011 const int kXOffset = kNormalHorizontalEdgeThickness + kEdgeItemPadding + |
983 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 1012 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
984 IDR_OMNIBOX_HTTP)->width() + kItemPadding; | 1013 IDR_OMNIBOX_HTTP)->width() + kItemPadding; |
(...skipping 11 matching lines...) Expand all Loading... |
996 #endif | 1025 #endif |
997 } | 1026 } |
998 | 1027 |
999 std::string LocationBarView::GetClassName() const { | 1028 std::string LocationBarView::GetClassName() const { |
1000 return kViewClassName; | 1029 return kViewClassName; |
1001 } | 1030 } |
1002 | 1031 |
1003 bool LocationBarView::SkipDefaultKeyEventProcessing( | 1032 bool LocationBarView::SkipDefaultKeyEventProcessing( |
1004 const views::KeyEvent& event) { | 1033 const views::KeyEvent& event) { |
1005 #if defined(OS_WIN) | 1034 #if defined(OS_WIN) |
| 1035 bool views_omnibox = UseViewsOmnibox(); |
1006 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { | 1036 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { |
1007 if (HasValidSuggestText()) { | 1037 if (HasValidSuggestText()) { |
1008 // Return true so that the edit sees the tab and commits the suggestion. | 1038 // Return true so that the edit sees the tab and commits the suggestion. |
1009 return true; | 1039 return true; |
1010 } | 1040 } |
1011 if (keyword_hint_view_->IsVisible() && !event.IsShiftDown()) { | 1041 if (keyword_hint_view_->IsVisible() && !event.IsShiftDown()) { |
1012 // Return true so the edit gets the tab event and enters keyword mode. | 1042 // Return true so the edit gets the tab event and enters keyword mode. |
1013 return true; | 1043 return true; |
1014 } | 1044 } |
1015 | 1045 |
1016 // If the caret is not at the end, then tab moves the caret to the end. | 1046 // If the caret is not at the end, then tab moves the caret to the end. |
1017 if (!location_entry_->IsCaretAtEnd()) | 1047 if (!views_omnibox && !GetOmniboxViewWin()->IsCaretAtEnd()) |
1018 return true; | 1048 return true; |
1019 | 1049 |
1020 // Tab while showing instant commits instant immediately. | 1050 // Tab while showing instant commits instant immediately. |
1021 // Return true so that focus traversal isn't attempted. The edit ends | 1051 // Return true so that focus traversal isn't attempted. The edit ends |
1022 // up doing nothing in this case. | 1052 // up doing nothing in this case. |
1023 if (location_entry_->model()->AcceptCurrentInstantPreview()) | 1053 if (location_entry_->model()->AcceptCurrentInstantPreview()) |
1024 return true; | 1054 return true; |
1025 } | 1055 } |
1026 | 1056 |
1027 return location_entry_->SkipDefaultKeyEventProcessing(event); | 1057 if (!views_omnibox) |
| 1058 return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event); |
| 1059 NOTIMPLEMENTED(); |
| 1060 return false; |
1028 #else | 1061 #else |
1029 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in | 1062 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in |
1030 // src/views/focus/focus_manager.cc for details. | 1063 // src/views/focus/focus_manager.cc for details. |
1031 return false; | 1064 return false; |
1032 #endif | 1065 #endif |
1033 } | 1066 } |
1034 | 1067 |
1035 void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) { | 1068 void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) { |
1036 state->role = ui::AccessibilityTypes::ROLE_GROUPING; | 1069 state->role = ui::AccessibilityTypes::ROLE_GROUPING; |
1037 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); | 1070 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 if (*name == prefs::kEditBookmarksEnabled) | 1247 if (*name == prefs::kEditBookmarksEnabled) |
1215 Update(NULL); | 1248 Update(NULL); |
1216 } | 1249 } |
1217 } | 1250 } |
1218 | 1251 |
1219 #if defined(OS_WIN) | 1252 #if defined(OS_WIN) |
1220 bool LocationBarView::HasValidSuggestText() const { | 1253 bool LocationBarView::HasValidSuggestText() const { |
1221 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1254 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
1222 !suggested_text_view_->GetText().empty(); | 1255 !suggested_text_view_->GetText().empty(); |
1223 } | 1256 } |
| 1257 |
| 1258 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
| 1259 CHECK(UseViewsOmnibox()); |
| 1260 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
| 1261 } |
| 1262 |
| 1263 bool LocationBarView::UseViewsOmnibox() { |
| 1264 return views::Widget::IsPureViews() || |
| 1265 views::NativeTextfieldViews::IsTextfieldViewsEnabled(); |
| 1266 } |
1224 #endif | 1267 #endif |
OLD | NEW |