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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" | 51 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
52 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | 52 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
53 #include "chrome/browser/ui/views/translate/translate_icon_view.h" | 53 #include "chrome/browser/ui/views/translate/translate_icon_view.h" |
54 #include "chrome/grit/generated_resources.h" | 54 #include "chrome/grit/generated_resources.h" |
55 #include "components/bookmarks/common/bookmark_pref_names.h" | 55 #include "components/bookmarks/common/bookmark_pref_names.h" |
56 #include "components/favicon/content/content_favicon_driver.h" | 56 #include "components/favicon/content/content_favicon_driver.h" |
57 #include "components/omnibox/browser/omnibox_popup_model.h" | 57 #include "components/omnibox/browser/omnibox_popup_model.h" |
58 #include "components/omnibox/browser/omnibox_popup_view.h" | 58 #include "components/omnibox/browser/omnibox_popup_view.h" |
59 #include "components/search_engines/template_url.h" | 59 #include "components/search_engines/template_url.h" |
60 #include "components/search_engines/template_url_service.h" | 60 #include "components/search_engines/template_url_service.h" |
| 61 #include "components/toolbar/toolbar_model.h" |
61 #include "components/translate/core/browser/language_state.h" | 62 #include "components/translate/core/browser/language_state.h" |
62 #include "components/ui/zoom/zoom_controller.h" | 63 #include "components/ui/zoom/zoom_controller.h" |
63 #include "components/ui/zoom/zoom_event_manager.h" | 64 #include "components/ui/zoom/zoom_event_manager.h" |
64 #include "content/public/browser/render_widget_host_view.h" | 65 #include "content/public/browser/render_widget_host_view.h" |
65 #include "content/public/browser/web_contents.h" | 66 #include "content/public/browser/web_contents.h" |
66 #include "extensions/browser/extension_registry.h" | 67 #include "extensions/browser/extension_registry.h" |
67 #include "extensions/common/feature_switch.h" | 68 #include "extensions/common/feature_switch.h" |
68 #include "grit/components_scaled_resources.h" | 69 #include "grit/components_scaled_resources.h" |
69 #include "grit/theme_resources.h" | 70 #include "grit/theme_resources.h" |
70 #include "ui/accessibility/ax_view_state.h" | 71 #include "ui/accessibility/ax_view_state.h" |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 return suggested_text_view_->visible() && | 1034 return suggested_text_view_->visible() && |
1034 !suggested_text_view_->size().IsEmpty(); | 1035 !suggested_text_view_->size().IsEmpty(); |
1035 } | 1036 } |
1036 | 1037 |
1037 bool LocationBarView::ShouldShowKeywordBubble() const { | 1038 bool LocationBarView::ShouldShowKeywordBubble() const { |
1038 return !omnibox_view_->model()->keyword().empty() && | 1039 return !omnibox_view_->model()->keyword().empty() && |
1039 !omnibox_view_->model()->is_keyword_hint(); | 1040 !omnibox_view_->model()->is_keyword_hint(); |
1040 } | 1041 } |
1041 | 1042 |
1042 bool LocationBarView::ShouldShowEVBubble() const { | 1043 bool LocationBarView::ShouldShowEVBubble() const { |
1043 const ChromeToolbarModel* chrome_toolbar_model = | 1044 return (GetToolbarModel()->GetSecurityLevel(false) == |
1044 static_cast<const ChromeToolbarModel*>(GetToolbarModel()); | |
1045 return (chrome_toolbar_model->GetSecurityLevel(false) == | |
1046 security_state::SecurityStateModel::EV_SECURE); | 1045 security_state::SecurityStateModel::EV_SECURE); |
1047 } | 1046 } |
1048 | 1047 |
1049 //////////////////////////////////////////////////////////////////////////////// | 1048 //////////////////////////////////////////////////////////////////////////////// |
1050 // LocationBarView, private LocationBar implementation: | 1049 // LocationBarView, private LocationBar implementation: |
1051 | 1050 |
1052 void LocationBarView::ShowFirstRunBubble() { | 1051 void LocationBarView::ShowFirstRunBubble() { |
1053 // Wait until search engines have loaded to show the first run bubble. | 1052 // Wait until search engines have loaded to show the first run bubble. |
1054 TemplateURLService* url_service = | 1053 TemplateURLService* url_service = |
1055 TemplateURLServiceFactory::GetForProfile(profile()); | 1054 TemplateURLServiceFactory::GetForProfile(profile()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 // LocationBarView, private TemplateURLServiceObserver implementation: | 1371 // LocationBarView, private TemplateURLServiceObserver implementation: |
1373 | 1372 |
1374 void LocationBarView::OnTemplateURLServiceChanged() { | 1373 void LocationBarView::OnTemplateURLServiceChanged() { |
1375 template_url_service_->RemoveObserver(this); | 1374 template_url_service_->RemoveObserver(this); |
1376 template_url_service_ = nullptr; | 1375 template_url_service_ = nullptr; |
1377 // If the browser is no longer active, let's not show the info bubble, as this | 1376 // If the browser is no longer active, let's not show the info bubble, as this |
1378 // would make the browser the active window again. | 1377 // would make the browser the active window again. |
1379 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1378 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
1380 ShowFirstRunBubble(); | 1379 ShowFirstRunBubble(); |
1381 } | 1380 } |
OLD | NEW |