| 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/page_info_helper.h" | 5 #include "chrome/browser/ui/views/location_bar/page_info_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 9 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // Do not show page info if the user has been editing the location | 28 // Do not show page info if the user has been editing the location |
| 29 // bar, or the location bar is at the NTP. | 29 // bar, or the location bar is at the NTP. |
| 30 if (location_bar_->GetLocationEntry()->IsEditingOrEmpty()) | 30 if (location_bar_->GetLocationEntry()->IsEditingOrEmpty()) |
| 31 return; | 31 return; |
| 32 | 32 |
| 33 WebContents* tab = location_bar_->GetWebContents(); | 33 WebContents* tab = location_bar_->GetWebContents(); |
| 34 if (!tab) | 34 if (!tab) |
| 35 return; | 35 return; |
| 36 const NavigationController& controller = tab->GetController(); | 36 const NavigationController& controller = tab->GetController(); |
| 37 NavigationEntry* nav_entry = controller.GetActiveEntry(); | 37 // Important to use GetVisibleEntry to match what's showing in the omnibox. |
| 38 NavigationEntry* nav_entry = controller.GetVisibleEntry(); |
| 38 if (!nav_entry) { | 39 if (!nav_entry) { |
| 39 NOTREACHED(); | 40 NOTREACHED(); |
| 40 return; | 41 return; |
| 41 } | 42 } |
| 42 | 43 |
| 43 location_bar_->delegate()->ShowWebsiteSettings( | 44 location_bar_->delegate()->ShowWebsiteSettings( |
| 44 tab, nav_entry->GetURL(), nav_entry->GetSSL()); | 45 tab, nav_entry->GetURL(), nav_entry->GetSSL()); |
| 45 } | 46 } |
| OLD | NEW |