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

Side by Side Diff: chrome/browser/ui/gtk/location_bar_view_gtk.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) 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/gtk/location_bar_view_gtk.h" 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "ui/base/dragdrop/gtk_dnd_util.h" 63 #include "ui/base/dragdrop/gtk_dnd_util.h"
64 #include "ui/base/gtk/gtk_hig_constants.h" 64 #include "ui/base/gtk/gtk_hig_constants.h"
65 #include "ui/base/l10n/l10n_util.h" 65 #include "ui/base/l10n/l10n_util.h"
66 #include "ui/base/resource/resource_bundle.h" 66 #include "ui/base/resource/resource_bundle.h"
67 #include "ui/gfx/canvas_skia_paint.h" 67 #include "ui/gfx/canvas_skia_paint.h"
68 #include "ui/gfx/font.h" 68 #include "ui/gfx/font.h"
69 #include "ui/gfx/gtk_util.h" 69 #include "ui/gfx/gtk_util.h"
70 #include "ui/gfx/image/image.h" 70 #include "ui/gfx/image/image.h"
71 #include "webkit/glue/window_open_disposition.h" 71 #include "webkit/glue/window_open_disposition.h"
72 72
73 using content::NavigationController;
73 using content::NavigationEntry; 74 using content::NavigationEntry;
74 using content::OpenURLParams; 75 using content::OpenURLParams;
75 using content::WebContents; 76 using content::WebContents;
76 77
77 namespace { 78 namespace {
78 79
79 // We are positioned with a little bit of extra space that we don't use now. 80 // We are positioned with a little bit of extra space that we don't use now.
80 const int kTopMargin = 1; 81 const int kTopMargin = 1;
81 const int kBottomMargin = 1; 82 const int kBottomMargin = 1;
82 const int kLeftMargin = 1; 83 const int kLeftMargin = 1;
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 // Do not show page info if the user has been editing the location 1035 // Do not show page info if the user has been editing the location
1035 // bar, or the location bar is at the NTP. 1036 // bar, or the location bar is at the NTP.
1036 if (location_entry()->IsEditingOrEmpty()) 1037 if (location_entry()->IsEditingOrEmpty())
1037 return FALSE; 1038 return FALSE;
1038 1039
1039 // (0,0) event coordinates indicates that the release came at the end of 1040 // (0,0) event coordinates indicates that the release came at the end of
1040 // a drag. 1041 // a drag.
1041 if (event->x == 0 && event->y == 0) 1042 if (event->x == 0 && event->y == 0)
1042 return FALSE; 1043 return FALSE;
1043 1044
1044 NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); 1045 const NavigationController& controller = tab->GetController();
1046 NavigationEntry* nav_entry = controller.GetActiveEntry();
1045 if (!nav_entry) { 1047 if (!nav_entry) {
1046 NOTREACHED(); 1048 NOTREACHED();
1047 return FALSE; 1049 return FALSE;
1048 } 1050 }
1049 tab->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true); 1051 Browser* browser = Browser::GetBrowserForController(&controller, NULL);
Ben Goodger (Google) 2012/02/14 17:52:56 You shouldn't need to do this. This object has a b
jam 2012/02/14 18:06:08 thanks, I missed that, i'll send you a cl updating
1052 browser->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true);
1050 return TRUE; 1053 return TRUE;
1051 } else if (event->button == 2) { 1054 } else if (event->button == 2) {
1052 // When the user middle clicks on the location icon, try to open the 1055 // When the user middle clicks on the location icon, try to open the
1053 // contents of the PRIMARY selection in the current tab. 1056 // contents of the PRIMARY selection in the current tab.
1054 // If the click was outside our bounds, do nothing. 1057 // If the click was outside our bounds, do nothing.
1055 if (!gtk_util::WidgetBounds(sender).Contains( 1058 if (!gtk_util::WidgetBounds(sender).Contains(
1056 gfx::Point(event->x, event->y))) { 1059 gfx::Point(event->x, event->y))) {
1057 return FALSE; 1060 return FALSE;
1058 } 1061 }
1059 1062
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 std::string badge_text = page_action_->GetBadgeText(tab_id); 1649 std::string badge_text = page_action_->GetBadgeText(tab_id);
1647 if (badge_text.empty()) 1650 if (badge_text.empty())
1648 return FALSE; 1651 return FALSE;
1649 1652
1650 gfx::CanvasSkiaPaint canvas(event, false); 1653 gfx::CanvasSkiaPaint canvas(event, false);
1651 GtkAllocation allocation; 1654 GtkAllocation allocation;
1652 gtk_widget_get_allocation(widget, &allocation); 1655 gtk_widget_get_allocation(widget, &allocation);
1653 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id); 1656 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id);
1654 return FALSE; 1657 return FALSE;
1655 } 1658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698