Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/gtk/bookmarks/bookmark_menu_controller_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 14 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 15 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 15 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 18 #include "chrome/browser/ui/gtk/menu_gtk.h" | 18 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 19 #include "chrome/browser/ui/views/event_utils.h" | |
|
Elliot Glaysher
2011/08/24 18:04:49
Please move event_utils to a common location; this
shinyak (Google)
2011/08/25 05:54:10
Done.
just removed this header file because it is
| |
| 19 #include "content/browser/tab_contents/page_navigator.h" | 20 #include "content/browser/tab_contents/page_navigator.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 22 #include "grit/ui_resources.h" | 23 #include "grit/ui_resources.h" |
| 23 #include "ui/base/dragdrop/gtk_dnd_util.h" | 24 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/gfx/gtk_util.h" | 26 #include "ui/gfx/gtk_util.h" |
| 26 #include "webkit/glue/window_open_disposition.h" | 27 #include "webkit/glue/window_open_disposition.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 // Don't handle this message; it was a drag. | 287 // Don't handle this message; it was a drag. |
| 287 ignore_button_release_ = false; | 288 ignore_button_release_ = false; |
| 288 return FALSE; | 289 return FALSE; |
| 289 } | 290 } |
| 290 | 291 |
| 291 // Releasing either button 1 or 2 should trigger the bookmark. | 292 // Releasing either button 1 or 2 should trigger the bookmark. |
| 292 if (!gtk_menu_item_get_submenu(GTK_MENU_ITEM(sender))) { | 293 if (!gtk_menu_item_get_submenu(GTK_MENU_ITEM(sender))) { |
| 293 // The menu item is a link node. | 294 // The menu item is a link node. |
| 294 if (event->button == 1 || event->button == 2) { | 295 if (event->button == 1 || event->button == 2) { |
| 295 WindowOpenDisposition disposition = | 296 WindowOpenDisposition disposition = |
| 296 event_utils::DispositionFromEventFlags(event->state); | 297 event_utils::DispositionFromGdkState(event->state); |
| 298 | |
| 297 NavigateToMenuItem(sender, disposition); | 299 NavigateToMenuItem(sender, disposition); |
| 298 | 300 |
| 299 // We need to manually dismiss the popup menu because we're overriding | 301 // We need to manually dismiss the popup menu because we're overriding |
| 300 // button-release-event. | 302 // button-release-event. |
| 301 gtk_menu_popdown(GTK_MENU(menu_)); | 303 gtk_menu_popdown(GTK_MENU(menu_)); |
| 302 return TRUE; | 304 return TRUE; |
| 303 } | 305 } |
| 304 } else { | 306 } else { |
| 305 // The menu item is a folder node. | 307 // The menu item is a folder node. |
| 306 if (event->button == 1) { | 308 if (event->button == 1) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 } | 365 } |
| 364 | 366 |
| 365 void BookmarkMenuController::OnMenuItemDragGet( | 367 void BookmarkMenuController::OnMenuItemDragGet( |
| 366 GtkWidget* widget, GdkDragContext* context, | 368 GtkWidget* widget, GdkDragContext* context, |
| 367 GtkSelectionData* selection_data, | 369 GtkSelectionData* selection_data, |
| 368 guint target_type, guint time) { | 370 guint target_type, guint time) { |
| 369 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); | 371 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); |
| 370 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, | 372 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, |
| 371 profile_); | 373 profile_); |
| 372 } | 374 } |
| OLD | NEW |