| 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/click_handler.h" | 5 #include "chrome/browser/ui/views/location_bar/click_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents.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" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 using content::NavigationController; | 14 using content::NavigationController; |
| 15 using content::NavigationEntry; | 15 using content::NavigationEntry; |
| 16 using content::WebContents; | 16 using content::WebContents; |
| 17 | 17 |
| 18 ClickHandler::ClickHandler(const views::View* owner, | 18 ClickHandler::ClickHandler(const views::View* owner, |
| 19 LocationBarView* location_bar) | 19 LocationBarView* location_bar) |
| 20 : owner_(owner), | 20 : owner_(owner), |
| 21 location_bar_(location_bar) { | 21 location_bar_(location_bar) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { | 24 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { |
| 25 if (!owner_->HitTest(event.location())) | 25 if (!owner_->HitTest(event.location())) |
| 26 return; | 26 return; |
| 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_->GetTabContentsWrapper()->web_contents(); | 33 WebContents* tab = location_bar_->GetTabContents()->web_contents(); |
| 34 const NavigationController& controller = tab->GetController(); | 34 const NavigationController& controller = tab->GetController(); |
| 35 NavigationEntry* nav_entry = controller.GetActiveEntry(); | 35 NavigationEntry* nav_entry = controller.GetActiveEntry(); |
| 36 if (!nav_entry) { | 36 if (!nav_entry) { |
| 37 NOTREACHED(); | 37 NOTREACHED(); |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 | 40 |
| 41 location_bar_->delegate()->ShowPageInfo( | 41 location_bar_->delegate()->ShowPageInfo( |
| 42 tab, nav_entry->GetURL(), nav_entry->GetSSL(), true); | 42 tab, nav_entry->GetURL(), nav_entry->GetSSL(), true); |
| 43 } | 43 } |
| OLD | NEW |