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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 security_level_ = security_level; | 104 security_level_ = security_level; |
105 is_url_malware_ = is_url_malware; | 105 is_url_malware_ = is_url_malware; |
106 | 106 |
107 label_ = OriginChip::LabelFromURLForProfile(displayed_url, profile_); | 107 label_ = OriginChip::LabelFromURLForProfile(displayed_url, profile_); |
108 if (security_level_ == ToolbarModel::EV_SECURE) { | 108 if (security_level_ == ToolbarModel::EV_SECURE) { |
109 label_ = l10n_util::GetStringFUTF16(IDS_SITE_CHIP_EV_SSL_LABEL, | 109 label_ = l10n_util::GetStringFUTF16(IDS_SITE_CHIP_EV_SSL_LABEL, |
110 toolbar_model->GetEVCertName(), | 110 toolbar_model->GetEVCertName(), |
111 label_); | 111 label_); |
112 } | 112 } |
113 | 113 |
114 const extensions::Extension* extension = NULL; | |
115 | |
114 if (displayed_url_.SchemeIs(extensions::kExtensionScheme)) { | 116 if (displayed_url_.SchemeIs(extensions::kExtensionScheme)) { |
115 icon_ = IDR_EXTENSIONS_FAVICON; | 117 extension = |
116 | |
117 const extensions::Extension* extension = | |
118 extensions::ExtensionSystem::Get(profile_)->extension_service()-> | 118 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
119 extensions()->GetExtensionOrAppByURL(displayed_url_); | 119 extensions()->GetExtensionOrAppByURL(displayed_url_); |
120 } | |
121 | |
122 if (extension) { | |
123 icon_ = IDR_EXTENSIONS_FAVICON; | |
120 extension_icon_image_.reset( | 124 extension_icon_image_.reset( |
Peter Kasting
2014/05/22 17:30:29
It seems like an even simpler change would have be
groby-ooo-7-16
2014/05/22 23:13:00
Done.
| |
121 new extensions::IconImage(profile_, | 125 new extensions::IconImage(profile_, |
122 extension, | 126 extension, |
123 extensions::IconsInfo::GetIcons(extension), | 127 extensions::IconsInfo::GetIcons(extension), |
124 extension_misc::EXTENSION_ICON_BITTY, | 128 extension_misc::EXTENSION_ICON_BITTY, |
125 extensions::util::GetDefaultAppIcon(), | 129 extensions::util::GetDefaultAppIcon(), |
126 owner_)); | 130 owner_)); |
127 | 131 |
128 // Forces load of the image. | 132 // Forces load of the image. |
129 extension_icon_image_->image_skia().GetRepresentation(1.0f); | 133 extension_icon_image_->image_skia().GetRepresentation(1.0f); |
130 if (!extension_icon_image_->image_skia().image_reps().empty()) | 134 if (!extension_icon_image_->image_skia().image_reps().empty()) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 | 246 |
243 #if defined(OS_CHROMEOS) | 247 #if defined(OS_CHROMEOS) |
244 if (url.SchemeIs(chrome::kCrosScheme) || | 248 if (url.SchemeIs(chrome::kCrosScheme) || |
245 url.SchemeIs(chrome::kDriveScheme)) | 249 url.SchemeIs(chrome::kDriveScheme)) |
246 return base::UTF8ToUTF16(url.spec()); | 250 return base::UTF8ToUTF16(url.spec()); |
247 #endif | 251 #endif |
248 | 252 |
249 // If all else fails, return the hostname. | 253 // If all else fails, return the hostname. |
250 return base::UTF8ToUTF16(url.host()); | 254 return base::UTF8ToUTF16(url.host()); |
251 } | 255 } |
OLD | NEW |