| 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/toolbar/origin_chip_info.h" | 5 #include "chrome/browser/ui/toolbar/origin_chip_info.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (host == chrome::kChromeUISettingsHost) | 74 if (host == chrome::kChromeUISettingsHost) |
| 75 return IDS_SETTINGS_TITLE; | 75 return IDS_SETTINGS_TITLE; |
| 76 if (host == chrome::kChromeUIVersionHost) | 76 if (host == chrome::kChromeUIVersionHost) |
| 77 return IDS_ABOUT_VERSION_TITLE; | 77 return IDS_ABOUT_VERSION_TITLE; |
| 78 | 78 |
| 79 return -1; | 79 return -1; |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 OriginChipInfo::OriginChipInfo(extensions::IconImage::Observer* owner, | 84 OriginChipInfo::OriginChipInfo( |
| 85 Profile* profile) | 85 extensions::IconImage::Observer* owner, |
| 86 Profile* profile) |
| 86 : owner_(owner), | 87 : owner_(owner), |
| 87 profile_(profile), | 88 profile_(profile) {} |
| 88 security_level_(ToolbarModel::NONE), | |
| 89 is_url_malware_(false), | |
| 90 icon_(IDR_PRODUCT_LOGO_16) { | |
| 91 } | |
| 92 | 89 |
| 93 OriginChipInfo::~OriginChipInfo() { | 90 OriginChipInfo::~OriginChipInfo() {} |
| 94 } | |
| 95 | 91 |
| 96 bool OriginChipInfo::Update(const content::WebContents* web_contents, | 92 bool OriginChipInfo::Update(const content::WebContents* web_contents, |
| 97 const ToolbarModel* toolbar_model) { | 93 const ToolbarModel* toolbar_model) { |
| 98 GURL displayed_url = toolbar_model->GetURL(); | 94 GURL displayed_url = toolbar_model->GetURL(); |
| 99 ToolbarModel::SecurityLevel security_level = | 95 ToolbarModel::SecurityLevel security_level = |
| 100 toolbar_model->GetSecurityLevel(true); | 96 toolbar_model->GetSecurityLevel(true); |
| 101 bool is_url_malware = OriginChip::IsMalware(displayed_url, web_contents); | 97 bool is_url_malware = OriginChip::IsMalware(displayed_url, web_contents); |
| 102 | 98 |
| 103 if ((displayed_url_ == displayed_url) && | 99 if ((displayed_url_ == displayed_url) && |
| 104 (security_level_ == security_level) && | 100 (security_level_ == security_level) && |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 248 |
| 253 #if defined(OS_CHROMEOS) | 249 #if defined(OS_CHROMEOS) |
| 254 if (url.SchemeIs(chrome::kCrosScheme) || | 250 if (url.SchemeIs(chrome::kCrosScheme) || |
| 255 url.SchemeIs(chrome::kDriveScheme)) | 251 url.SchemeIs(chrome::kDriveScheme)) |
| 256 return base::UTF8ToUTF16(url.spec()); | 252 return base::UTF8ToUTF16(url.spec()); |
| 257 #endif | 253 #endif |
| 258 | 254 |
| 259 // If all else fails, return the hostname. | 255 // If all else fails, return the hostname. |
| 260 return base::UTF8ToUTF16(url.host()); | 256 return base::UTF8ToUTF16(url.host()); |
| 261 } | 257 } |
| OLD | NEW |