Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/ui/views/location_bar/click_handler.cc

Issue 9390015: Get rid of ShowPageInfo on WebContents and WebContentsDelegate. Chrome shouldn't have to go throu... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix gtk+mac Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser.h"
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
9 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/navigation_entry.h" 11 #include "content/public/browser/navigation_entry.h"
11 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
12 #include "ui/views/view.h" 13 #include "ui/views/view.h"
13 14
15 using content::NavigationController;
14 using content::NavigationEntry; 16 using content::NavigationEntry;
15 using content::WebContents; 17 using content::WebContents;
16 18
17 ClickHandler::ClickHandler(const views::View* owner, 19 ClickHandler::ClickHandler(const views::View* owner,
18 LocationBarView* location_bar) 20 LocationBarView* location_bar)
19 : owner_(owner), 21 : owner_(owner),
20 location_bar_(location_bar) { 22 location_bar_(location_bar) {
21 } 23 }
22 24
23 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { 25 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) {
24 if (!owner_->HitTest(event.location())) 26 if (!owner_->HitTest(event.location()))
25 return; 27 return;
26 28
27 // Do not show page info if the user has been editing the location 29 // Do not show page info if the user has been editing the location
28 // bar, or the location bar is at the NTP. 30 // bar, or the location bar is at the NTP.
29 if (location_bar_->location_entry()->IsEditingOrEmpty()) 31 if (location_bar_->location_entry()->IsEditingOrEmpty())
30 return; 32 return;
31 33
32 WebContents* tab = location_bar_->GetTabContentsWrapper()->web_contents(); 34 WebContents* tab = location_bar_->GetTabContentsWrapper()->web_contents();
33 NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); 35 const NavigationController& controller = tab->GetController();
36 NavigationEntry* nav_entry = controller.GetActiveEntry();
34 if (!nav_entry) { 37 if (!nav_entry) {
35 NOTREACHED(); 38 NOTREACHED();
36 return; 39 return;
37 } 40 }
38 tab->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true); 41
42 Browser* browser = Browser::GetBrowserForController(&controller, NULL);
43 browser->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true);
39 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698