| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 //////////////////////////////////////////////////////////////////////////////// | 1060 //////////////////////////////////////////////////////////////////////////////// |
| 1061 // LocationBarView, private LocationBarTesting implementation: | 1061 // LocationBarView, private LocationBarTesting implementation: |
| 1062 | 1062 |
| 1063 int LocationBarView::PageActionCount() { | 1063 int LocationBarView::PageActionCount() { |
| 1064 return page_action_views_.size(); | 1064 return page_action_views_.size(); |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 int LocationBarView::PageActionVisibleCount() { | 1067 int LocationBarView::PageActionVisibleCount() { |
| 1068 int result = 0; | 1068 size_t result = 0; |
| 1069 for (const auto& action_view : page_action_views_) { | 1069 for (const auto& action_view : page_action_views_) { |
| 1070 if (action_view->visible()) | 1070 if (action_view->visible()) |
| 1071 ++result; | 1071 ++result; |
| 1072 } | 1072 } |
| 1073 return result; | 1073 return result; |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 ExtensionAction* LocationBarView::GetPageAction(size_t index) { | 1076 ExtensionAction* LocationBarView::GetPageAction(size_t index) { |
| 1077 if (index < page_action_views_.size()) | 1077 if (index < page_action_views_.size()) |
| 1078 return page_action_views_[index]->image_view()->extension_action(); | 1078 return page_action_views_[index]->image_view()->extension_action(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 NOTREACHED(); | 1111 NOTREACHED(); |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 bool LocationBarView::GetBookmarkStarVisibility() { | 1114 bool LocationBarView::GetBookmarkStarVisibility() { |
| 1115 DCHECK(star_view_); | 1115 DCHECK(star_view_); |
| 1116 return star_view_->visible(); | 1116 return star_view_->visible(); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 int LocationBarView::ContentSettingImageModelCount() { |
| 1120 return content_setting_views_.size(); |
| 1121 } |
| 1122 |
| 1123 ContentSettingImageModel* LocationBarView::GetContentSettingImageModel( |
| 1124 size_t index) { |
| 1125 DCHECK(index >= 0 && index < content_setting_views_.size()); |
| 1126 return content_setting_views_.at(index)->content_setting_image_model(); |
| 1127 } |
| 1128 |
| 1119 //////////////////////////////////////////////////////////////////////////////// | 1129 //////////////////////////////////////////////////////////////////////////////// |
| 1120 // LocationBarView, private views::View implementation: | 1130 // LocationBarView, private views::View implementation: |
| 1121 | 1131 |
| 1122 const char* LocationBarView::GetClassName() const { | 1132 const char* LocationBarView::GetClassName() const { |
| 1123 return kViewClassName; | 1133 return kViewClassName; |
| 1124 } | 1134 } |
| 1125 | 1135 |
| 1126 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 1136 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 1127 OmniboxPopupView* popup = omnibox_view_->model()->popup_model()->view(); | 1137 OmniboxPopupView* popup = omnibox_view_->model()->popup_model()->view(); |
| 1128 if (popup->IsOpen()) | 1138 if (popup->IsOpen()) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 // LocationBarView, private TemplateURLServiceObserver implementation: | 1245 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1236 | 1246 |
| 1237 void LocationBarView::OnTemplateURLServiceChanged() { | 1247 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1238 template_url_service_->RemoveObserver(this); | 1248 template_url_service_->RemoveObserver(this); |
| 1239 template_url_service_ = nullptr; | 1249 template_url_service_ = nullptr; |
| 1240 // If the browser is no longer active, let's not show the info bubble, as this | 1250 // If the browser is no longer active, let's not show the info bubble, as this |
| 1241 // would make the browser the active window again. | 1251 // would make the browser the active window again. |
| 1242 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1252 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1243 ShowFirstRunBubble(); | 1253 ShowFirstRunBubble(); |
| 1244 } | 1254 } |
| 1255 |
| 1256 //////////////////////////////////////////////////////////////////////////////// |
| 1257 // LocationBarView, private function(s) for testing: |
| 1258 |
| 1259 ContentSettingImageView* |
| 1260 LocationBarView::GetContentSettingImageViewFromImageModel( |
| 1261 ContentSettingImageModel* image_model) { |
| 1262 for (auto i = content_setting_views_.begin(); |
| 1263 i < content_setting_views_.end(); i++) { |
| 1264 if ((*i)->content_setting_image_model() == image_model) |
| 1265 return *i; |
| 1266 } |
| 1267 NOTREACHED(); |
| 1268 return nullptr; |
| 1269 } |
| 1270 |
| 1271 |
| OLD | NEW |