Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3904)

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 2555063003: Render extension URLs with chips (Closed)
Patch Set: pkasting comments and rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 7e0308f78245989201da54f19cfb0cd286036423..c9cb7c49ca234c18c4ccb37a525b175d960639aa 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -458,8 +458,9 @@ void LocationBarViewMac::Layout() {
// displayed, even if the width is narrow.
CGFloat available_width =
[cell availableWidthInFrame:[[cell controlView] frame]];
- is_width_available_for_security_verbose_ =
- available_width >= kMinURLWidth || ShouldShowEVBubble();
+ is_width_available_for_security_verbose_ = available_width >= kMinURLWidth ||
+ ShouldShowEVBubble() ||
+ ShouldShowExtensionBubble();
if (!keyword.empty() && !is_keyword_hint) {
// Switch from location icon to keyword mode.
@@ -482,6 +483,15 @@ void LocationBarViewMac::Layout() {
base::string16 label(GetToolbarModel()->GetEVCertName());
security_state_bubble_decoration_->SetFullLabel(
base::SysUTF16ToNSString(label));
+ } else if (ShouldShowExtensionBubble()) {
+ // Switch from location icon to show the extension bubble instead.
+ location_icon_decoration_->SetVisible(false);
+ security_state_bubble_decoration_->SetVisible(true);
+
+ base::string16 label(
+ GetExtensionName(GetToolbarModel()->GetURL(), GetWebContents()));
+ security_state_bubble_decoration_->SetFullLabel(
+ base::SysUTF16ToNSString(label));
} else if (ShouldShowSecurityState() ||
security_state_bubble_decoration_->AnimatingOut()) {
bool is_security_state_visible =
@@ -652,6 +662,10 @@ bool LocationBarViewMac::ShouldShowEVBubble() const {
security_state::EV_SECURE;
}
+bool LocationBarViewMac::ShouldShowExtensionBubble() const {
+ return GetToolbarModel()->GetURL().SchemeIs(extensions::kExtensionScheme);
+}
+
bool LocationBarViewMac::ShouldShowSecurityState() const {
if (omnibox_view_->IsEditingOrEmpty() ||
omnibox_view_->model()->is_keyword_hint()) {
@@ -860,7 +874,8 @@ void LocationBarViewMac::UpdateSecurityState(bool tab_changed) {
// out, animate it back in. Otherwise, if the security state has changed,
// animate the decoration if animation is enabled and the state changed is
// not from a tab switch.
- if (ShouldShowSecurityState() && is_width_available_for_security_verbose_) {
+ if ((ShouldShowSecurityState() || ShouldShowExtensionBubble()) &&
+ is_width_available_for_security_verbose_) {
bool is_secure_to_secure = IsSecureConnection(new_security_level) &&
IsSecureConnection(security_level_);
bool is_new_security_level =

Powered by Google App Engine
This is Rietveld 408576698