OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_wrapper.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/browser/tab_contents/navigation_controller.h" | 9 #include "content/browser/tab_contents/navigation_controller.h" |
10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
11 #include "views/view.h" | 11 #include "ui/views/view.h" |
12 | 12 |
13 ClickHandler::ClickHandler(const views::View* owner, | 13 ClickHandler::ClickHandler(const views::View* owner, |
14 LocationBarView* location_bar) | 14 LocationBarView* location_bar) |
15 : owner_(owner), | 15 : owner_(owner), |
16 location_bar_(location_bar) { | 16 location_bar_(location_bar) { |
17 } | 17 } |
18 | 18 |
19 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { | 19 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { |
20 if (!owner_->HitTest(event.location())) | 20 if (!owner_->HitTest(event.location())) |
21 return; | 21 return; |
22 | 22 |
23 // Do not show page info if the user has been editing the location | 23 // Do not show page info if the user has been editing the location |
24 // bar, or the location bar is at the NTP. | 24 // bar, or the location bar is at the NTP. |
25 if (location_bar_->location_entry()->IsEditingOrEmpty()) | 25 if (location_bar_->location_entry()->IsEditingOrEmpty()) |
26 return; | 26 return; |
27 | 27 |
28 TabContents* tab = location_bar_->GetTabContentsWrapper()->tab_contents(); | 28 TabContents* tab = location_bar_->GetTabContentsWrapper()->tab_contents(); |
29 NavigationEntry* nav_entry = tab->controller().GetActiveEntry(); | 29 NavigationEntry* nav_entry = tab->controller().GetActiveEntry(); |
30 if (!nav_entry) { | 30 if (!nav_entry) { |
31 NOTREACHED(); | 31 NOTREACHED(); |
32 return; | 32 return; |
33 } | 33 } |
34 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); | 34 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); |
35 } | 35 } |
OLD | NEW |