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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1036 } | 1036 } |
1037 | 1037 |
1038 //////////////////////////////////////////////////////////////////////////////// | 1038 //////////////////////////////////////////////////////////////////////////////// |
1039 // LocationBarView, private LocationBarTesting implementation: | 1039 // LocationBarView, private LocationBarTesting implementation: |
1040 | 1040 |
1041 int LocationBarView::PageActionCount() { | 1041 int LocationBarView::PageActionCount() { |
1042 return page_action_views_.size(); | 1042 return page_action_views_.size(); |
1043 } | 1043 } |
1044 | 1044 |
1045 int LocationBarView::PageActionVisibleCount() { | 1045 int LocationBarView::PageActionVisibleCount() { |
1046 int result = 0; | 1046 size_t result = 0; |
tapted
2017/02/03 00:35:41
why this change? -- (style guide prefers int in ge
kylix_rd
2017/02/03 18:55:04
Done.
Peter Kasting
2017/02/03 22:20:41
See other comment on style guide not actually pref
| |
1047 for (const auto& action_view : page_action_views_) { | 1047 for (const auto& action_view : page_action_views_) { |
1048 if (action_view->visible()) | 1048 if (action_view->visible()) |
1049 ++result; | 1049 ++result; |
1050 } | 1050 } |
1051 return result; | 1051 return result; |
1052 } | 1052 } |
1053 | 1053 |
1054 ExtensionAction* LocationBarView::GetPageAction(size_t index) { | 1054 ExtensionAction* LocationBarView::GetPageAction(size_t index) { |
1055 if (index < page_action_views_.size()) | 1055 if (index < page_action_views_.size()) |
1056 return page_action_views_[index]->image_view()->extension_action(); | 1056 return page_action_views_[index]->image_view()->extension_action(); |
(...skipping 30 matching lines...) Expand all Loading... | |
1087 } | 1087 } |
1088 | 1088 |
1089 NOTREACHED(); | 1089 NOTREACHED(); |
1090 } | 1090 } |
1091 | 1091 |
1092 bool LocationBarView::GetBookmarkStarVisibility() { | 1092 bool LocationBarView::GetBookmarkStarVisibility() { |
1093 DCHECK(star_view_); | 1093 DCHECK(star_view_); |
1094 return star_view_->visible(); | 1094 return star_view_->visible(); |
1095 } | 1095 } |
1096 | 1096 |
1097 int LocationBarView::ContentSettingImageModelCount() { | |
1098 return content_setting_views_.size(); | |
1099 } | |
1100 | |
1101 ContentSettingImageModel* LocationBarView::GetContentSettingImageModel( | |
1102 size_t index) { | |
1103 DCHECK(index >= 0 && index < content_setting_views_.size()); | |
1104 return content_setting_views_.at(index)->content_setting_image_model(); | |
1105 } | |
1106 | |
1097 //////////////////////////////////////////////////////////////////////////////// | 1107 //////////////////////////////////////////////////////////////////////////////// |
1098 // LocationBarView, private views::View implementation: | 1108 // LocationBarView, private views::View implementation: |
1099 | 1109 |
1100 const char* LocationBarView::GetClassName() const { | 1110 const char* LocationBarView::GetClassName() const { |
1101 return kViewClassName; | 1111 return kViewClassName; |
1102 } | 1112 } |
1103 | 1113 |
1104 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 1114 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
1105 OmniboxPopupView* popup = omnibox_view_->model()->popup_model()->view(); | 1115 OmniboxPopupView* popup = omnibox_view_->model()->popup_model()->view(); |
1106 if (popup->IsOpen()) | 1116 if (popup->IsOpen()) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1213 // LocationBarView, private TemplateURLServiceObserver implementation: | 1223 // LocationBarView, private TemplateURLServiceObserver implementation: |
1214 | 1224 |
1215 void LocationBarView::OnTemplateURLServiceChanged() { | 1225 void LocationBarView::OnTemplateURLServiceChanged() { |
1216 template_url_service_->RemoveObserver(this); | 1226 template_url_service_->RemoveObserver(this); |
1217 template_url_service_ = nullptr; | 1227 template_url_service_ = nullptr; |
1218 // If the browser is no longer active, let's not show the info bubble, as this | 1228 // If the browser is no longer active, let's not show the info bubble, as this |
1219 // would make the browser the active window again. | 1229 // would make the browser the active window again. |
1220 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1230 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
1221 ShowFirstRunBubble(); | 1231 ShowFirstRunBubble(); |
1222 } | 1232 } |
1233 | |
1234 //////////////////////////////////////////////////////////////////////////////// | |
1235 // LocationBarView, private function(s) for testing: | |
1236 | |
1237 ContentSettingImageView* | |
1238 LocationBarView::GetContentSettingImageViewFromImageModel( | |
tapted
2017/02/03 00:35:40
(move to TestApi class)
| |
1239 ContentSettingImageModel* image_model) { | |
1240 for (auto i = content_setting_views_.begin(); | |
tapted
2017/02/03 00:35:40
for (ContentSettingImageView* view : content_setti
| |
1241 i < content_setting_views_.end(); i++) { | |
1242 if ((*i)->content_setting_image_model() == image_model) | |
1243 return *i; | |
1244 } | |
1245 NOTREACHED(); | |
1246 return nullptr; | |
1247 } | |
1248 | |
1249 | |
OLD | NEW |