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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 2555063003: Render extension URLs with chips (Closed)
Patch Set: Enlarge the window so that it's over the minimum window size 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/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index fcd840cbec7a6f9a272b07bbd78dc8c7fe455dc1..f7cacd66d7bc002d9a8f077d11f12fa000cfa832 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -496,9 +496,14 @@ gfx::Size LocationBarView::GetPreferredSize() const {
if (ShouldShowKeywordBubble()) {
// The selected keyword view can collapse completely.
} else if (ShouldShowSecurityChip()) {
- base::string16 security_text = GetSecurityText();
+ const base::string16 security_text = GetSecurityText();
leading_width +=
location_icon_view_->GetMinimumSizeForLabelText(security_text).width();
+ } else if (ShouldShowExtensionChip()) {
+ const base::string16 extension_name = GetExtensionName(
+ GetToolbarModel()->GetURL(), delegate_->GetWebContents());
+ leading_width +=
+ location_icon_view_->GetMinimumSizeForLabelText(extension_name).width();
} else {
leading_width +=
kHorizontalPadding + location_icon_view_->GetMinimumSize().width();
@@ -569,6 +574,13 @@ void LocationBarView::Layout() {
selected_keyword_view_->ResetImage();
}
}
+ } else if (ShouldShowExtensionChip()) {
+ location_icon_view_->SetLabel(GetExtensionName(
+ GetToolbarModel()->GetURL(), delegate_->GetWebContents()));
+ const double kMaxBubbleFraction = 0.5;
+ leading_decorations.AddDecoration(vertical_padding, location_height, false,
+ kMaxBubbleFraction, 0, item_padding,
+ location_icon_view_);
} else if (ShouldShowSecurityChip()) {
location_icon_view_->SetLabel(GetSecurityText());
// The largest fraction of the omnibox that can be taken by the EV bubble.
@@ -699,9 +711,9 @@ void LocationBarView::Update(const WebContents* contents) {
else
omnibox_view_->Update();
- location_icon_view_->SetSecurityState(
- ShouldShowSecurityChip(), !contents && ShouldAnimateSecurityChip());
-
+ location_icon_view_->SetDisplayState(
+ ShouldShowSecurityChip() || ShouldShowExtensionChip(),
+ !contents && ShouldAnimateSecurityChip());
OnChanged(); // NOTE: Calls Layout().
}
@@ -956,6 +968,10 @@ bool LocationBarView::ShouldAnimateSecurityChip() const {
level == SecurityLevel::HTTP_SHOW_WARNING);
}
+bool LocationBarView::ShouldShowExtensionChip() const {
+ return GetToolbarModel()->GetURL().SchemeIs(extensions::kExtensionScheme);
+}
+
////////////////////////////////////////////////////////////////////////////////
// LocationBarView, private LocationBar implementation:

Powered by Google App Engine
This is Rietveld 408576698