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/chrome_security_state_model_client.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 "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
16 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 WebContents* contents = location_bar_->GetWebContents(); | 105 WebContents* contents = location_bar_->GetWebContents(); |
106 if (!contents) | 106 if (!contents) |
107 return false; | 107 return false; |
108 | 108 |
109 // Important to use GetVisibleEntry to match what's showing in the omnibox. | 109 // Important to use GetVisibleEntry to match what's showing in the omnibox. |
110 NavigationEntry* entry = contents->GetController().GetVisibleEntry(); | 110 NavigationEntry* entry = contents->GetController().GetVisibleEntry(); |
111 // The visible entry can be nullptr in the case of window.open(""). | 111 // The visible entry can be nullptr in the case of window.open(""). |
112 if (!entry) | 112 if (!entry) |
113 return false; | 113 return false; |
114 | 114 |
115 ChromeSecurityStateModelClient* model_client = | 115 SecurityStateTabHelper* helper = |
116 ChromeSecurityStateModelClient::FromWebContents(contents); | 116 SecurityStateTabHelper::FromWebContents(contents); |
117 DCHECK(model_client); | 117 DCHECK(helper); |
118 security_state::SecurityStateModel::SecurityInfo security_info; | 118 security_state::SecurityStateModel::SecurityInfo security_info; |
119 model_client->GetSecurityInfo(&security_info); | 119 helper->GetSecurityInfo(&security_info); |
120 | 120 |
121 location_bar_->delegate()->ShowWebsiteSettings( | 121 location_bar_->delegate()->ShowWebsiteSettings( |
122 contents, entry->GetVirtualURL(), security_info); | 122 contents, entry->GetVirtualURL(), security_info); |
123 return true; | 123 return true; |
124 } | 124 } |
125 | 125 |
126 gfx::Size LocationIconView::GetMinimumSizeForLabelText( | 126 gfx::Size LocationIconView::GetMinimumSizeForLabelText( |
127 const base::string16& text) const { | 127 const base::string16& text) const { |
128 views::Label label(text, font_list()); | 128 views::Label label(text, font_list()); |
129 return GetMinimumSizeForPreferredSize( | 129 return GetMinimumSizeForPreferredSize( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return size; | 164 return size; |
165 } | 165 } |
166 | 166 |
167 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { | 167 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { |
168 // Do not show page info if the user has been editing the location bar or the | 168 // Do not show page info if the user has been editing the location bar or the |
169 // location bar is at the NTP. | 169 // location bar is at the NTP. |
170 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) | 170 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) |
171 return; | 171 return; |
172 ProcessLocatedEvent(event); | 172 ProcessLocatedEvent(event); |
173 } | 173 } |
OLD | NEW |