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(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 } | 896 } |
897 | 897 |
898 SkBitmap LocationBarView::GetFavIcon() const { | 898 SkBitmap LocationBarView::GetFavIcon() const { |
899 return GetTabContentsFromDelegate(delegate_)->GetFavIcon(); | 899 return GetTabContentsFromDelegate(delegate_)->GetFavIcon(); |
900 } | 900 } |
901 | 901 |
902 std::wstring LocationBarView::GetTitle() const { | 902 std::wstring LocationBarView::GetTitle() const { |
903 return UTF16ToWideHack(GetTabContentsFromDelegate(delegate_)->GetTitle()); | 903 return UTF16ToWideHack(GetTabContentsFromDelegate(delegate_)->GetTitle()); |
904 } | 904 } |
905 | 905 |
| 906 bool LocationBarView::IsKeywordHintVisible() const { |
| 907 return keyword_hint_view_->IsVisible(); |
| 908 } |
| 909 |
906 int LocationBarView::AvailableWidth(int location_bar_width) { | 910 int LocationBarView::AvailableWidth(int location_bar_width) { |
907 return location_bar_width - location_entry_->TextWidth(); | 911 return location_bar_width - location_entry_->TextWidth(); |
908 } | 912 } |
909 | 913 |
910 void LocationBarView::LayoutView(views::View* view, | 914 void LocationBarView::LayoutView(views::View* view, |
911 int padding, | 915 int padding, |
912 int available_width, | 916 int available_width, |
913 bool leading, | 917 bool leading, |
914 gfx::Rect* bounds) { | 918 gfx::Rect* bounds) { |
915 DCHECK(view && bounds); | 919 DCHECK(view && bounds); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 return kViewClassName; | 1055 return kViewClassName; |
1052 } | 1056 } |
1053 | 1057 |
1054 bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 1058 bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { |
1055 #if defined(OS_WIN) | 1059 #if defined(OS_WIN) |
1056 if (views::FocusManager::IsTabTraversalKeyEvent(e)) { | 1060 if (views::FocusManager::IsTabTraversalKeyEvent(e)) { |
1057 if (HasValidSuggestText()) { | 1061 if (HasValidSuggestText()) { |
1058 // Return true so that the edit sees the tab and commits the suggestion. | 1062 // Return true so that the edit sees the tab and commits the suggestion. |
1059 return true; | 1063 return true; |
1060 } | 1064 } |
1061 if (keyword_hint_view_->IsVisible() && !e.IsShiftDown()) { | 1065 if (IsKeywordHintVisible() && !e.IsShiftDown()) { |
1062 // Return true so the edit gets the tab event and enters keyword mode. | 1066 // Return true so the edit gets the tab event and enters keyword mode. |
1063 return true; | 1067 return true; |
1064 } | 1068 } |
1065 | 1069 |
1066 // Tab while showing instant commits instant immediately. | 1070 // Tab while showing instant commits instant immediately. |
1067 // Return true so that focus traversal isn't attempted. The edit ends | 1071 // Return true so that focus traversal isn't attempted. The edit ends |
1068 // up doing nothing in this case. | 1072 // up doing nothing in this case. |
1069 if (AcceptCurrentInstantPreview()) | 1073 if (AcceptCurrentInstantPreview()) |
1070 return true; | 1074 return true; |
1071 } | 1075 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 template_url_model_ = NULL; | 1264 template_url_model_ = NULL; |
1261 ShowFirstRunBubble(bubble_type_); | 1265 ShowFirstRunBubble(bubble_type_); |
1262 } | 1266 } |
1263 | 1267 |
1264 #if defined(OS_WIN) | 1268 #if defined(OS_WIN) |
1265 bool LocationBarView::HasValidSuggestText() { | 1269 bool LocationBarView::HasValidSuggestText() { |
1266 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1270 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
1267 !suggested_text_view_->GetText().empty(); | 1271 !suggested_text_view_->GetText().empty(); |
1268 } | 1272 } |
1269 #endif | 1273 #endif |
OLD | NEW |