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

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

Issue 424383002: Experiment with displaying origins in the Omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 87fc383129d84feeff7705866f15aeb3e0af0482..8e3c40b3411291169b8d8baede1edad19c20d493 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -212,6 +212,9 @@ LocationBarView::LocationBarView(Browser* browser,
origin_chip_view_(NULL),
location_icon_view_(NULL),
ev_bubble_view_(NULL),
+ good_bubble_view_(NULL),
+ dubious_bubble_view_(NULL),
+ bad_bubble_view_(NULL),
ime_inline_autocomplete_view_(NULL),
selected_keyword_view_(NULL),
suggested_text_view_(NULL),
@@ -294,12 +297,31 @@ void LocationBarView::Init() {
const SkColor background_color =
GetColor(ToolbarModel::NONE, LocationBarView::BACKGROUND);
+
ev_bubble_view_ = new EVBubbleView(
bubble_font_list, GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT),
background_color, this);
ev_bubble_view_->set_drag_controller(this);
AddChildView(ev_bubble_view_);
+ good_bubble_view_ = new EVBubbleView(
+ bubble_font_list, GetColor(ToolbarModel::SECURE, SECURITY_TEXT),
+ background_color, this);
+ good_bubble_view_->set_drag_controller(this);
+ AddChildView(good_bubble_view_);
+
+ dubious_bubble_view_ = new EVBubbleView(
+ bubble_font_list, GetColor(ToolbarModel::SECURITY_WARNING, SECURITY_TEXT),
+ background_color, this);
+ dubious_bubble_view_->set_drag_controller(this);
+ AddChildView(dubious_bubble_view_);
+
+ bad_bubble_view_ = new EVBubbleView(
+ bubble_font_list, GetColor(ToolbarModel::SECURITY_ERROR, SECURITY_TEXT),
+ background_color, this);
+ bad_bubble_view_->set_drag_controller(this);
+ AddChildView(bad_bubble_view_);
+
// Initialize the Omnibox view.
omnibox_view_ = new OmniboxViewViews(
this, profile(), command_updater(),
@@ -697,6 +719,9 @@ void LocationBarView::Layout() {
selected_keyword_view_->SetVisible(false);
location_icon_view_->SetVisible(false);
ev_bubble_view_->SetVisible(false);
+ good_bubble_view_->SetVisible(false);
+ dubious_bubble_view_->SetVisible(false);
+ bad_bubble_view_->SetVisible(false);
keyword_hint_view_->SetVisible(false);
LocationBarLayout leading_decorations(
@@ -751,6 +776,28 @@ void LocationBarView::Layout() {
leading_decorations.AddDecoration(bubble_location_y, bubble_height, false,
kMaxBubbleFraction, kBubblePadding,
kItemPadding, ev_bubble_view_);
+ } else if (ShouldShowGoodBubble()) {
+ good_bubble_view_->SetLabel(GetToolbarModel()->GetOriginDisplayName());
+ // The largest fraction of the omnibox that can be taken by the Good bubble.
+ const double kMaxBubbleFraction = 0.5;
+ leading_decorations.AddDecoration(bubble_location_y, bubble_height, false,
+ kMaxBubbleFraction, kBubblePadding,
+ kItemPadding, good_bubble_view_);
+ } else if (ShouldShowDubiousBubble()) {
+ dubious_bubble_view_->SetLabel(GetToolbarModel()->GetOriginDisplayName());
+ // The largest fraction of the omnibox that can be taken by the Dubious
+ // bubble.
+ const double kMaxBubbleFraction = 0.5;
+ leading_decorations.AddDecoration(bubble_location_y, bubble_height, false,
+ kMaxBubbleFraction, kBubblePadding,
+ kItemPadding, dubious_bubble_view_);
+ } else if (ShouldShowBadBubble()) {
+ bad_bubble_view_->SetLabel(GetToolbarModel()->GetOriginDisplayName());
+ // The largest fraction of the omnibox that can be taken by the Bad bubble.
+ const double kMaxBubbleFraction = 0.5;
+ leading_decorations.AddDecoration(bubble_location_y, bubble_height, false,
+ kMaxBubbleFraction, kBubblePadding,
+ kItemPadding, bad_bubble_view_);
} else if (!origin_chip_view_->visible()) {
leading_decorations.AddDecoration(
vertical_edge_thickness(), location_height,
@@ -1288,6 +1335,27 @@ bool LocationBarView::ShouldShowEVBubble() const {
(GetToolbarModel()->GetSecurityLevel(false) == ToolbarModel::EV_SECURE);
}
+bool LocationBarView::ShouldShowGoodBubble() const {
+ return !chrome::ShouldDisplayOriginChip() &&
+ (GetToolbarModel()->GetSecurityLevel(false) == ToolbarModel::SECURE);
+}
+
+bool LocationBarView::ShouldShowDubiousBubble() const {
+ ToolbarModel::SecurityLevel security =
+ GetToolbarModel()->GetSecurityLevel(false);
+ return !chrome::ShouldDisplayOriginChip() &&
+ (security == ToolbarModel::SECURITY_POLICY_WARNING ||
+ security == ToolbarModel::SECURITY_WARNING);
+}
+
+bool LocationBarView::ShouldShowBadBubble() const {
+ ToolbarModel::SecurityLevel security =
+ GetToolbarModel()->GetSecurityLevel(false);
+ return !chrome::ShouldDisplayOriginChip() &&
+ (security == ToolbarModel::NONE ||
+ security == ToolbarModel::SECURITY_ERROR);
+}
+
double LocationBarView::GetValueForAnimation(bool hide) const {
int calculated_offset;
const gfx::Tween::Type tween_type = hide ? kHideTweenType : kShowTweenType;
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698