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/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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 return TRUE; | 1177 return TRUE; |
1178 } | 1178 } |
1179 | 1179 |
1180 return FALSE; | 1180 return FALSE; |
1181 } | 1181 } |
1182 | 1182 |
1183 void LocationBarViewGtk::OnIconDragData(GtkWidget* sender, | 1183 void LocationBarViewGtk::OnIconDragData(GtkWidget* sender, |
1184 GdkDragContext* context, | 1184 GdkDragContext* context, |
1185 GtkSelectionData* data, | 1185 GtkSelectionData* data, |
1186 guint info, guint time) { | 1186 guint info, guint time) { |
1187 WebContents* tab = GetWebContents(); | 1187 ui::WriteURLWithName(data, drag_url_, drag_title_, info); |
1188 if (!tab) | |
1189 return; | |
1190 ui::WriteURLWithName(data, tab->GetURL(), tab->GetTitle(), info); | |
1191 } | 1188 } |
1192 | 1189 |
1193 void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender, | 1190 void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender, |
1194 GdkDragContext* context) { | 1191 GdkDragContext* context) { |
1195 SkBitmap favicon = GetFavicon(); | 1192 SkBitmap favicon = GetFavicon(); |
1196 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(favicon); | 1193 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(favicon); |
1197 if (!pixbuf) | 1194 if (!pixbuf) |
1198 return; | 1195 return; |
1199 drag_icon_ = bookmark_utils::GetDragRepresentation(pixbuf, | 1196 drag_icon_ = bookmark_utils::GetDragRepresentation(pixbuf, |
1200 GetTitle(), theme_service_); | 1197 GetTitle(), theme_service_); |
1201 g_object_unref(pixbuf); | 1198 g_object_unref(pixbuf); |
1202 gtk_drag_set_icon_widget(context, drag_icon_, 0, 0); | 1199 gtk_drag_set_icon_widget(context, drag_icon_, 0, 0); |
| 1200 |
| 1201 WebContents* tab = GetWebContents(); |
| 1202 if (!tab) |
| 1203 return; |
| 1204 drag_url_ = tab->GetURL(); |
| 1205 drag_title_ = tab->GetTitle(); |
1203 } | 1206 } |
1204 | 1207 |
1205 void LocationBarViewGtk::OnIconDragEnd(GtkWidget* sender, | 1208 void LocationBarViewGtk::OnIconDragEnd(GtkWidget* sender, |
1206 GdkDragContext* context) { | 1209 GdkDragContext* context) { |
1207 DCHECK(drag_icon_); | 1210 DCHECK(drag_icon_); |
1208 gtk_widget_destroy(drag_icon_); | 1211 gtk_widget_destroy(drag_icon_); |
1209 drag_icon_ = NULL; | 1212 drag_icon_ = NULL; |
| 1213 drag_url_ = GURL::EmptyGURL(); |
| 1214 drag_title_.clear(); |
1210 } | 1215 } |
1211 | 1216 |
1212 void LocationBarViewGtk::OnHboxSizeAllocate(GtkWidget* sender, | 1217 void LocationBarViewGtk::OnHboxSizeAllocate(GtkWidget* sender, |
1213 GtkAllocation* allocation) { | 1218 GtkAllocation* allocation) { |
1214 if (hbox_width_ != allocation->width) { | 1219 if (hbox_width_ != allocation->width) { |
1215 hbox_width_ = allocation->width; | 1220 hbox_width_ = allocation->width; |
1216 UpdateEVCertificateLabelSize(); | 1221 UpdateEVCertificateLabelSize(); |
1217 } | 1222 } |
1218 } | 1223 } |
1219 | 1224 |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 } | 1979 } |
1975 | 1980 |
1976 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( | 1981 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( |
1977 ExtensionAction* action) { | 1982 ExtensionAction* action) { |
1978 ExtensionPopupGtk::Show( | 1983 ExtensionPopupGtk::Show( |
1979 action->GetPopupUrl(current_tab_id_), | 1984 action->GetPopupUrl(current_tab_id_), |
1980 owner_->browser_, | 1985 owner_->browser_, |
1981 event_box_.get(), | 1986 event_box_.get(), |
1982 ExtensionPopupGtk::SHOW_AND_INSPECT); | 1987 ExtensionPopupGtk::SHOW_AND_INSPECT); |
1983 } | 1988 } |
OLD | NEW |