OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/origin_chip_view.h" | 5 #include "chrome/browser/ui/views/location_bar/origin_chip_view.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 } | 163 } |
164 | 164 |
165 OriginChipView::~OriginChipView() { | 165 OriginChipView::~OriginChipView() { |
166 scoped_refptr<SafeBrowsingService> sb_service = | 166 scoped_refptr<SafeBrowsingService> sb_service = |
167 g_browser_process->safe_browsing_service(); | 167 g_browser_process->safe_browsing_service(); |
168 if (sb_service.get() && sb_service->ui_manager()) | 168 if (sb_service.get() && sb_service->ui_manager()) |
169 sb_service->ui_manager()->RemoveObserver(this); | 169 sb_service->ui_manager()->RemoveObserver(this); |
170 } | 170 } |
171 | 171 |
172 bool OriginChipView::ShouldShow() { | 172 bool OriginChipView::ShouldShow() { |
173 return chrome::ShouldDisplayOriginChipV2() && | 173 return location_bar_view_->GetToolbarModel()->ShouldShowOriginChip(); |
Peter Kasting
2014/05/05 22:39:04
Let's eliminate ShouldShow() entirely and have cal
macourteau
2014/05/08 21:35:55
Done.
| |
174 location_bar_view_->GetToolbarModel()->WouldOmitURLDueToOriginChip() && | |
175 location_bar_view_->GetToolbarModel()->origin_chip_enabled(); | |
176 } | 174 } |
177 | 175 |
178 void OriginChipView::Update(content::WebContents* web_contents) { | 176 void OriginChipView::Update(content::WebContents* web_contents) { |
179 if (!web_contents) | 177 if (!web_contents) |
180 return; | 178 return; |
181 | 179 |
182 // Note: security level can change async as the connection is made. | 180 // Note: security level can change async as the connection is made. |
183 GURL url = location_bar_view_->GetToolbarModel()->GetURL(); | 181 GURL url = location_bar_view_->GetToolbarModel()->GetURL(); |
184 const ToolbarModel::SecurityLevel security_level = | 182 const ToolbarModel::SecurityLevel security_level = |
185 location_bar_view_->GetToolbarModel()->GetSecurityLevel(true); | 183 location_bar_view_->GetToolbarModel()->GetSecurityLevel(true); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 | 385 |
388 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will | 386 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will |
389 // have already been called. | 387 // have already been called. |
390 void OriginChipView::OnSafeBrowsingHit( | 388 void OriginChipView::OnSafeBrowsingHit( |
391 const SafeBrowsingUIManager::UnsafeResource& resource) {} | 389 const SafeBrowsingUIManager::UnsafeResource& resource) {} |
392 | 390 |
393 void OriginChipView::OnSafeBrowsingMatch( | 391 void OriginChipView::OnSafeBrowsingMatch( |
394 const SafeBrowsingUIManager::UnsafeResource& resource) { | 392 const SafeBrowsingUIManager::UnsafeResource& resource) { |
395 OnChanged(); | 393 OnChanged(); |
396 } | 394 } |
OLD | NEW |