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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 45 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
46 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 46 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
47 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 47 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
48 #include "chrome/browser/ui/views/location_bar/star_view.h" | 48 #include "chrome/browser/ui/views/location_bar/star_view.h" |
49 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 49 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
50 #include "chrome/browser/ui/views/location_bar/zoom_view.h" | 50 #include "chrome/browser/ui/views/location_bar/zoom_view.h" |
51 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" | 51 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
52 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" | 52 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
53 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | 53 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
54 #include "chrome/browser/ui/views/translate/translate_icon_view.h" | 54 #include "chrome/browser/ui/views/translate/translate_icon_view.h" |
| 55 #include "chrome/common/chrome_features.h" |
55 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
56 #include "chrome/grit/generated_resources.h" | 57 #include "chrome/grit/generated_resources.h" |
57 #include "chrome/grit/theme_resources.h" | 58 #include "chrome/grit/theme_resources.h" |
58 #include "components/bookmarks/common/bookmark_pref_names.h" | 59 #include "components/bookmarks/common/bookmark_pref_names.h" |
59 #include "components/favicon/content/content_favicon_driver.h" | 60 #include "components/favicon/content/content_favicon_driver.h" |
60 #include "components/grit/components_scaled_resources.h" | 61 #include "components/grit/components_scaled_resources.h" |
61 #include "components/omnibox/browser/omnibox_popup_model.h" | 62 #include "components/omnibox/browser/omnibox_popup_model.h" |
62 #include "components/omnibox/browser/omnibox_popup_view.h" | 63 #include "components/omnibox/browser/omnibox_popup_view.h" |
63 #include "components/prefs/pref_service.h" | 64 #include "components/prefs/pref_service.h" |
64 #include "components/search_engines/template_url.h" | 65 #include "components/search_engines/template_url.h" |
65 #include "components/search_engines/template_url_service.h" | 66 #include "components/search_engines/template_url_service.h" |
66 #include "components/toolbar/toolbar_model.h" | 67 #include "components/toolbar/toolbar_model.h" |
67 #include "components/translate/core/browser/language_state.h" | 68 #include "components/translate/core/browser/language_state.h" |
| 69 #include "components/variations/variations_associated_data.h" |
68 #include "components/zoom/zoom_controller.h" | 70 #include "components/zoom/zoom_controller.h" |
69 #include "components/zoom/zoom_event_manager.h" | 71 #include "components/zoom/zoom_event_manager.h" |
70 #include "content/public/browser/render_widget_host_view.h" | 72 #include "content/public/browser/render_widget_host_view.h" |
71 #include "content/public/browser/web_contents.h" | 73 #include "content/public/browser/web_contents.h" |
72 #include "extensions/browser/extension_registry.h" | 74 #include "extensions/browser/extension_registry.h" |
73 #include "extensions/common/feature_switch.h" | 75 #include "extensions/common/feature_switch.h" |
74 #include "ui/accessibility/ax_view_state.h" | 76 #include "ui/accessibility/ax_view_state.h" |
75 #include "ui/base/dragdrop/drag_drop_types.h" | 77 #include "ui/base/dragdrop/drag_drop_types.h" |
76 #include "ui/base/resource/resource_bundle.h" | 78 #include "ui/base/resource/resource_bundle.h" |
77 #include "ui/base/theme_provider.h" | 79 #include "ui/base/theme_provider.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 should_animate_nonsecure_state_(false) { | 148 should_animate_nonsecure_state_(false) { |
147 edit_bookmarks_enabled_.Init( | 149 edit_bookmarks_enabled_.Init( |
148 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 150 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
149 base::Bind(&LocationBarView::UpdateWithoutTabRestore, | 151 base::Bind(&LocationBarView::UpdateWithoutTabRestore, |
150 base::Unretained(this))); | 152 base::Unretained(this))); |
151 | 153 |
152 zoom::ZoomEventManager::GetForBrowserContext(profile) | 154 zoom::ZoomEventManager::GetForBrowserContext(profile) |
153 ->AddZoomEventManagerObserver(this); | 155 ->AddZoomEventManagerObserver(this); |
154 | 156 |
155 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 157 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 158 std::string security_chip_visibility; |
156 if (command_line->HasSwitch(switches::kSecurityChip)) { | 159 if (command_line->HasSwitch(switches::kSecurityChip)) { |
157 std::string security_chip_flag = | 160 security_chip_visibility = |
158 command_line->GetSwitchValueASCII(switches::kSecurityChip); | 161 command_line->GetSwitchValueASCII(switches::kSecurityChip); |
159 should_show_secure_state_ = | 162 } else if (base::FeatureList::IsEnabled(features::kSecurityChip)) { |
160 security_chip_flag == switches::kSecurityChipShowAll; | 163 security_chip_visibility = |
161 should_show_nonsecure_state_ = | 164 variations::GetVariationParamValueByFeature( |
162 security_chip_flag == switches::kSecurityChipShowAll || | 165 features::kSecurityChip, kSecurityChipFeatureVisibilityParam); |
163 security_chip_flag == switches::kSecurityChipShowNonSecureOnly; | |
164 } | 166 } |
165 | 167 |
| 168 should_show_secure_state_ = |
| 169 security_chip_visibility == switches::kSecurityChipShowAll; |
| 170 should_show_nonsecure_state_ = |
| 171 should_show_secure_state_ || |
| 172 security_chip_visibility == switches::kSecurityChipShowNonSecureOnly; |
| 173 |
| 174 std::string security_chip_animation; |
166 if (command_line->HasSwitch(switches::kSecurityChipAnimation)) { | 175 if (command_line->HasSwitch(switches::kSecurityChipAnimation)) { |
167 std::string security_chip_animation_flag = | 176 security_chip_animation = |
168 command_line->GetSwitchValueASCII(switches::kSecurityChipAnimation); | 177 command_line->GetSwitchValueASCII(switches::kSecurityChipAnimation); |
169 should_animate_secure_state_ = | 178 } else if (base::FeatureList::IsEnabled(features::kSecurityChip)) { |
170 security_chip_animation_flag == switches::kSecurityChipAnimationAll; | 179 security_chip_animation = variations::GetVariationParamValueByFeature( |
| 180 features::kSecurityChip, kSecurityChipFeatureAnimationParam); |
| 181 } |
171 | 182 |
172 should_animate_nonsecure_state_ = | 183 should_animate_secure_state_ = |
173 security_chip_animation_flag == | 184 security_chip_animation == switches::kSecurityChipAnimationAll; |
174 switches::kSecurityChipAnimationNonSecureOnly || | 185 should_animate_nonsecure_state_ = |
175 security_chip_animation_flag == switches::kSecurityChipAnimationAll; | 186 should_animate_secure_state_ || |
176 } | 187 security_chip_animation == switches::kSecurityChipAnimationNonSecureOnly; |
177 } | 188 } |
178 | 189 |
179 LocationBarView::~LocationBarView() { | 190 LocationBarView::~LocationBarView() { |
180 if (template_url_service_) | 191 if (template_url_service_) |
181 template_url_service_->RemoveObserver(this); | 192 template_url_service_->RemoveObserver(this); |
182 | 193 |
183 zoom::ZoomEventManager::GetForBrowserContext(profile()) | 194 zoom::ZoomEventManager::GetForBrowserContext(profile()) |
184 ->RemoveZoomEventManagerObserver(this); | 195 ->RemoveZoomEventManagerObserver(this); |
185 } | 196 } |
186 | 197 |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 // LocationBarView, private TemplateURLServiceObserver implementation: | 1358 // LocationBarView, private TemplateURLServiceObserver implementation: |
1348 | 1359 |
1349 void LocationBarView::OnTemplateURLServiceChanged() { | 1360 void LocationBarView::OnTemplateURLServiceChanged() { |
1350 template_url_service_->RemoveObserver(this); | 1361 template_url_service_->RemoveObserver(this); |
1351 template_url_service_ = nullptr; | 1362 template_url_service_ = nullptr; |
1352 // If the browser is no longer active, let's not show the info bubble, as this | 1363 // If the browser is no longer active, let's not show the info bubble, as this |
1353 // would make the browser the active window again. | 1364 // would make the browser the active window again. |
1354 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1365 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
1355 ShowFirstRunBubble(); | 1366 ShowFirstRunBubble(); |
1356 } | 1367 } |
OLD | NEW |