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

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

Issue 9479008: Re-factor location bar/toolbar code to get rid of the browser dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 8 years, 9 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) 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/browser.h" 7 #include "chrome/browser/ui/browser_show_actions.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.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 "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
11 #include "content/public/browser/navigation_entry.h" 11 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "ui/views/view.h" 13 #include "ui/views/view.h"
14 14
15 using content::NavigationController; 15 using content::NavigationController;
16 using content::NavigationEntry; 16 using content::NavigationEntry;
17 using content::WebContents; 17 using content::WebContents;
18 18
19 ClickHandler::ClickHandler(const views::View* owner, 19 ClickHandler::ClickHandler(const views::View* owner,
20 LocationBarView* location_bar) 20 LocationBarView* location_bar,
21 BrowserShowPageInfo* delegate)
21 : owner_(owner), 22 : owner_(owner),
22 location_bar_(location_bar) { 23 location_bar_(location_bar),
24 delegate_(delegate) {
23 } 25 }
24 26
25 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { 27 void ClickHandler::OnMouseReleased(const views::MouseEvent& event) {
26 if (!owner_->HitTest(event.location())) 28 if (!owner_->HitTest(event.location()))
27 return; 29 return;
28 30
29 // Do not show page info if the user has been editing the location 31 // Do not show page info if the user has been editing the location
30 // bar, or the location bar is at the NTP. 32 // bar, or the location bar is at the NTP.
31 if (location_bar_->location_entry()->IsEditingOrEmpty()) 33 if (location_bar_->location_entry()->IsEditingOrEmpty())
32 return; 34 return;
33 35
34 WebContents* tab = location_bar_->GetTabContentsWrapper()->web_contents(); 36 WebContents* tab = location_bar_->GetTabContentsWrapper()->web_contents();
35 const NavigationController& controller = tab->GetController(); 37 const NavigationController& controller = tab->GetController();
36 NavigationEntry* nav_entry = controller.GetActiveEntry(); 38 NavigationEntry* nav_entry = controller.GetActiveEntry();
37 if (!nav_entry) { 39 if (!nav_entry) {
38 NOTREACHED(); 40 NOTREACHED();
39 return; 41 return;
40 } 42 }
41 43
42 Browser* browser = Browser::GetBrowserForController(&controller, NULL); 44 delegate_->ShowPageInfo(tab, nav_entry->GetURL(), nav_entry->GetSSL(), true);
43 browser->ShowPageInfo(tab, nav_entry->GetURL(), nav_entry->GetSSL(), true);
44 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698