Chromium Code Reviews| 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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 809 false); | 809 false); |
| 810 content::NotificationService::current()->Notify( | 810 content::NotificationService::current()->Notify( |
| 811 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, | 811 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, |
| 812 content::Source<Profile>(profile), | 812 content::Source<Profile>(profile), |
| 813 content::Details<AccessibilityTextBoxInfo>(&info)); | 813 content::Details<AccessibilityTextBoxInfo>(&info)); |
| 814 | 814 |
| 815 // Update the keyword and search hint states. | 815 // Update the keyword and search hint states. |
| 816 OnChanged(); | 816 OnChanged(); |
| 817 } | 817 } |
| 818 | 818 |
| 819 SkBitmap LocationBarViewGtk::GetFavicon() const { | 819 gfx::Image LocationBarViewGtk::GetFavicon() const { |
| 820 return GetTabContents()->favicon_tab_helper()->GetFavicon().AsBitmap(); | 820 return GetTabContents()->favicon_tab_helper()->GetFavicon(); |
| 821 } | 821 } |
| 822 | 822 |
| 823 string16 LocationBarViewGtk::GetTitle() const { | 823 string16 LocationBarViewGtk::GetTitle() const { |
| 824 return GetWebContents()->GetTitle(); | 824 return GetWebContents()->GetTitle(); |
| 825 } | 825 } |
| 826 | 826 |
| 827 InstantController* LocationBarViewGtk::GetInstant() { | 827 InstantController* LocationBarViewGtk::GetInstant() { |
| 828 return browser_->instant_controller()->instant(); | 828 return browser_->instant_controller()->instant(); |
| 829 } | 829 } |
| 830 | 830 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1342 | 1342 |
| 1343 void LocationBarViewGtk::OnIconDragData(GtkWidget* sender, | 1343 void LocationBarViewGtk::OnIconDragData(GtkWidget* sender, |
| 1344 GdkDragContext* context, | 1344 GdkDragContext* context, |
| 1345 GtkSelectionData* data, | 1345 GtkSelectionData* data, |
| 1346 guint info, guint time) { | 1346 guint info, guint time) { |
| 1347 ui::WriteURLWithName(data, drag_url_, drag_title_, info); | 1347 ui::WriteURLWithName(data, drag_url_, drag_title_, info); |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender, | 1350 void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender, |
| 1351 GdkDragContext* context) { | 1351 GdkDragContext* context) { |
| 1352 SkBitmap favicon = GetFavicon(); | 1352 gfx::Image favicon = GetFavicon(); |
| 1353 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(favicon); | 1353 GdkPixbuf* pixbuf = favicon.ToGdkPixbuf(); |
|
Nico
2012/08/16 20:26:27
This will fail if favicon.IsEmpty(). Move the if(!
| |
| 1354 if (!pixbuf) | 1354 if (!pixbuf) |
| 1355 return; | 1355 return; |
| 1356 drag_icon_ = bookmark_utils::GetDragRepresentation(pixbuf, | 1356 drag_icon_ = bookmark_utils::GetDragRepresentation(pixbuf, |
| 1357 GetTitle(), theme_service_); | 1357 GetTitle(), theme_service_); |
| 1358 g_object_unref(pixbuf); | 1358 g_object_unref(pixbuf); |
|
Nico
2012/08/16 20:26:27
This is now wrong.
| |
| 1359 gtk_drag_set_icon_widget(context, drag_icon_, 0, 0); | 1359 gtk_drag_set_icon_widget(context, drag_icon_, 0, 0); |
| 1360 | 1360 |
| 1361 WebContents* tab = GetWebContents(); | 1361 WebContents* tab = GetWebContents(); |
| 1362 if (!tab) | 1362 if (!tab) |
| 1363 return; | 1363 return; |
| 1364 drag_url_ = tab->GetURL(); | 1364 drag_url_ = tab->GetURL(); |
| 1365 drag_title_ = tab->GetTitle(); | 1365 drag_title_ = tab->GetTitle(); |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 void LocationBarViewGtk::OnIconDragEnd(GtkWidget* sender, | 1368 void LocationBarViewGtk::OnIconDragEnd(GtkWidget* sender, |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( | 2055 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( |
| 2056 ExtensionAction* action) { | 2056 ExtensionAction* action) { |
| 2057 ExtensionPopupGtk::Show( | 2057 ExtensionPopupGtk::Show( |
| 2058 action->GetPopupUrl(current_tab_id_), | 2058 action->GetPopupUrl(current_tab_id_), |
| 2059 owner_->browser_, | 2059 owner_->browser_, |
| 2060 event_box_.get(), | 2060 event_box_.get(), |
| 2061 ExtensionPopupGtk::SHOW_AND_INSPECT); | 2061 ExtensionPopupGtk::SHOW_AND_INSPECT); |
| 2062 } | 2062 } |
| OLD | NEW |