| OLD | NEW |
| 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
" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |