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; | |
Peter Kasting
2016/10/24 21:08:16
Nit: |security_chip_visibility| to match constant
spqchan
2016/10/24 22:44:56
Done.
| |
156 if (command_line->HasSwitch(switches::kSecurityChip)) { | 159 if (command_line->HasSwitch(switches::kSecurityChip)) { |
157 std::string security_chip_flag = | 160 security_chip = command_line->GetSwitchValueASCII(switches::kSecurityChip); |
158 command_line->GetSwitchValueASCII(switches::kSecurityChip); | 161 } else if (base::FeatureList::IsEnabled(features::kSecurityChip)) { |
159 should_show_secure_state_ = | 162 security_chip = variations::GetVariationParamValueByFeature( |
160 security_chip_flag == switches::kSecurityChipShowAll; | 163 features::kSecurityChip, kSecurityChipFeatureVisibilityParam); |
161 should_show_nonsecure_state_ = | |
162 security_chip_flag == switches::kSecurityChipShowAll || | |
163 security_chip_flag == switches::kSecurityChipShowNonSecureOnly; | |
164 } | 164 } |
165 | 165 |
166 if (security_chip == switches::kSecurityChipShowNonSecureOnly) { | |
167 should_show_nonsecure_state_ = true; | |
168 } else if (security_chip == switches::kSecurityChipShowAll) { | |
169 should_show_secure_state_ = true; | |
170 should_show_nonsecure_state_ = true; | |
171 } | |
Peter Kasting
2016/10/24 21:08:17
Nit: Shorter:
should_show_secure_state_ = secur
spqchan
2016/10/24 22:44:56
Done.
| |
172 | |
173 std::string security_chip_animation; | |
166 if (command_line->HasSwitch(switches::kSecurityChipAnimation)) { | 174 if (command_line->HasSwitch(switches::kSecurityChipAnimation)) { |
167 std::string security_chip_animation_flag = | 175 security_chip_animation = |
168 command_line->GetSwitchValueASCII(switches::kSecurityChipAnimation); | 176 command_line->GetSwitchValueASCII(switches::kSecurityChipAnimation); |
169 should_animate_secure_state_ = | 177 } else if (base::FeatureList::IsEnabled(features::kSecurityChip)) { |
170 security_chip_animation_flag == switches::kSecurityChipAnimationAll; | 178 security_chip_animation = variations::GetVariationParamValueByFeature( |
179 features::kSecurityChip, kSecurityChipFeatureAnimationParam); | |
180 } | |
171 | 181 |
172 should_animate_nonsecure_state_ = | 182 if (security_chip_animation == |
173 security_chip_animation_flag == | 183 switches::kSecurityChipAnimationNonSecureOnly) { |
174 switches::kSecurityChipAnimationNonSecureOnly || | 184 should_animate_nonsecure_state_ = true; |
175 security_chip_animation_flag == switches::kSecurityChipAnimationAll; | 185 } else if (security_chip_animation == switches::kSecurityChipAnimationAll) { |
186 should_animate_secure_state_ = true; | |
187 should_animate_nonsecure_state_ = true; | |
176 } | 188 } |
177 } | 189 } |
178 | 190 |
179 LocationBarView::~LocationBarView() { | 191 LocationBarView::~LocationBarView() { |
180 if (template_url_service_) | 192 if (template_url_service_) |
181 template_url_service_->RemoveObserver(this); | 193 template_url_service_->RemoveObserver(this); |
182 | 194 |
183 zoom::ZoomEventManager::GetForBrowserContext(profile()) | 195 zoom::ZoomEventManager::GetForBrowserContext(profile()) |
184 ->RemoveZoomEventManagerObserver(this); | 196 ->RemoveZoomEventManagerObserver(this); |
185 } | 197 } |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1347 // LocationBarView, private TemplateURLServiceObserver implementation: | 1359 // LocationBarView, private TemplateURLServiceObserver implementation: |
1348 | 1360 |
1349 void LocationBarView::OnTemplateURLServiceChanged() { | 1361 void LocationBarView::OnTemplateURLServiceChanged() { |
1350 template_url_service_->RemoveObserver(this); | 1362 template_url_service_->RemoveObserver(this); |
1351 template_url_service_ = nullptr; | 1363 template_url_service_ = nullptr; |
1352 // If the browser is no longer active, let's not show the info bubble, as this | 1364 // 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. | 1365 // would make the browser the active window again. |
1354 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1366 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
1355 ShowFirstRunBubble(); | 1367 ShowFirstRunBubble(); |
1356 } | 1368 } |
OLD | NEW |