| 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_icon_image.h" | 10 #include "chrome/browser/extensions/extension_icon_image.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( | 84 OriginChipInfo::OriginChipInfo(extensions::IconImage::Observer* owner, |
| 85 extensions::IconImage::Observer* owner, | 85 Profile* profile) |
| 86 Profile* profile) | |
| 87 : owner_(owner), | 86 : owner_(owner), |
| 88 profile_(profile) {} | 87 profile_(profile), |
| 88 security_level_(ToolbarModel::NONE), |
| 89 is_url_malware_(false), |
| 90 icon_(IDR_PRODUCT_LOGO_16) { |
| 91 } |
| 89 | 92 |
| 90 OriginChipInfo::~OriginChipInfo() {} | 93 OriginChipInfo::~OriginChipInfo() { |
| 94 } |
| 91 | 95 |
| 92 bool OriginChipInfo::Update(const content::WebContents* web_contents, | 96 bool OriginChipInfo::Update(const content::WebContents* web_contents, |
| 93 const ToolbarModel* toolbar_model) { | 97 const ToolbarModel* toolbar_model) { |
| 94 GURL displayed_url = toolbar_model->GetURL(); | 98 GURL displayed_url = toolbar_model->GetURL(); |
| 95 ToolbarModel::SecurityLevel security_level = | 99 ToolbarModel::SecurityLevel security_level = |
| 96 toolbar_model->GetSecurityLevel(true); | 100 toolbar_model->GetSecurityLevel(true); |
| 97 bool is_url_malware = OriginChip::IsMalware(displayed_url, web_contents); | 101 bool is_url_malware = OriginChip::IsMalware(displayed_url, web_contents); |
| 98 | 102 |
| 99 if ((displayed_url_ == displayed_url) && | 103 if ((displayed_url_ == displayed_url) && |
| 100 (security_level_ == security_level) && | 104 (security_level_ == security_level) && |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 252 |
| 249 #if defined(OS_CHROMEOS) | 253 #if defined(OS_CHROMEOS) |
| 250 if (url.SchemeIs(chrome::kCrosScheme) || | 254 if (url.SchemeIs(chrome::kCrosScheme) || |
| 251 url.SchemeIs(chrome::kDriveScheme)) | 255 url.SchemeIs(chrome::kDriveScheme)) |
| 252 return base::UTF8ToUTF16(url.spec()); | 256 return base::UTF8ToUTF16(url.spec()); |
| 253 #endif | 257 #endif |
| 254 | 258 |
| 255 // If all else fails, return the hostname. | 259 // If all else fails, return the hostname. |
| 256 return base::UTF8ToUTF16(url.host()); | 260 return base::UTF8ToUTF16(url.host()); |
| 257 } | 261 } |
| OLD | NEW |