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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 2650033004: Show Page Info from Form-Not-Secure 'Learn more' link (Closed)
Patch Set: mathp comments Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/location_bar/location_icon_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
6 6
7 #include "chrome/browser/ssl/security_state_tab_helper.h" 7 #include "chrome/browser/ssl/security_state_tab_helper.h"
8 #include "chrome/browser/ui/view_ids.h" 8 #include "chrome/browser/ui/view_ids.h"
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " 10 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h "
11 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
12 #include "chrome/grit/theme_resources.h" 12 #include "chrome/grit/theme_resources.h"
13 #include "components/grit/components_scaled_resources.h" 13 #include "components/grit/components_scaled_resources.h"
14 #include "components/omnibox/browser/omnibox_edit_model.h" 14 #include "components/omnibox/browser/omnibox_edit_model.h"
15 #include "components/security_state/core/security_state.h" 15 #include "components/security_state/core/security_state.h"
msw 2017/01/25 20:22:40 nit: remove
estark 2017/01/26 18:41:58 Done.
16 #include "content/public/browser/navigation_controller.h" 16 #include "content/public/browser/navigation_controller.h"
msw 2017/01/25 20:22:40 nit: remove
estark 2017/01/26 18:41:58 Done.
17 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
msw 2017/01/25 20:22:40 nit: remove
estark 2017/01/26 18:41:58 Done.
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/views/controls/label.h" 20 #include "ui/views/controls/label.h"
21 21
22 using content::NavigationEntry; 22 using content::NavigationEntry;
msw 2017/01/25 20:22:40 nit: remove
estark 2017/01/26 18:41:58 Done.
23 using content::WebContents; 23 using content::WebContents;
24 24
25 LocationIconView::LocationIconView(const gfx::FontList& font_list, 25 LocationIconView::LocationIconView(const gfx::FontList& font_list,
26 LocationBarView* location_bar) 26 LocationBarView* location_bar)
27 : IconLabelBubbleView(font_list, true), 27 : IconLabelBubbleView(font_list, true),
28 suppress_mouse_released_action_(false), 28 suppress_mouse_released_action_(false),
29 location_bar_(location_bar), 29 location_bar_(location_bar),
30 animation_(this) { 30 animation_(this) {
31 set_id(VIEW_ID_LOCATION_ICON); 31 set_id(VIEW_ID_LOCATION_ICON);
32 32
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 SkColor LocationIconView::GetTextColor() const { 101 SkColor LocationIconView::GetTextColor() const {
102 return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT); 102 return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT);
103 } 103 }
104 104
105 bool LocationIconView::OnActivate(const ui::Event& event) { 105 bool LocationIconView::OnActivate(const ui::Event& event) {
106 WebContents* contents = location_bar_->GetWebContents(); 106 WebContents* contents = location_bar_->GetWebContents();
107 if (!contents) 107 if (!contents)
108 return false; 108 return false;
109 109 location_bar_->delegate()->ShowWebsiteSettings(contents);
110 // Important to use GetVisibleEntry to match what's showing in the omnibox.
111 NavigationEntry* entry = contents->GetController().GetVisibleEntry();
112 // The visible entry can be nullptr in the case of window.open("").
113 if (!entry)
114 return false;
115
116 SecurityStateTabHelper* helper =
117 SecurityStateTabHelper::FromWebContents(contents);
118 DCHECK(helper);
119 security_state::SecurityInfo security_info;
120 helper->GetSecurityInfo(&security_info);
121
122 location_bar_->delegate()->ShowWebsiteSettings(
123 contents, entry->GetVirtualURL(), security_info);
124 return true; 110 return true;
125 } 111 }
126 112
127 void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) { 113 void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
128 IconLabelBubbleView::GetAccessibleNodeData(node_data); 114 IconLabelBubbleView::GetAccessibleNodeData(node_data);
129 node_data->role = ui::AX_ROLE_POP_UP_BUTTON; 115 node_data->role = ui::AX_ROLE_POP_UP_BUTTON;
130 } 116 }
131 117
132 gfx::Size LocationIconView::GetMinimumSizeForLabelText( 118 gfx::Size LocationIconView::GetMinimumSizeForLabelText(
133 const base::string16& text) const { 119 const base::string16& text) const {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 return size; 157 return size;
172 } 158 }
173 159
174 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { 160 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) {
175 // Do not show page info if the user has been editing the location bar or the 161 // Do not show page info if the user has been editing the location bar or the
176 // location bar is at the NTP. 162 // location bar is at the NTP.
177 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) 163 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty())
178 return; 164 return;
179 ProcessLocatedEvent(event); 165 ProcessLocatedEvent(event);
180 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698