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

Side by Side Diff: chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc

Issue 6250014: Move more dnd related files to ui/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « chrome/browser/ui/gtk/bookmark_bar_gtk.cc ('k') | chrome/browser/ui/gtk/bookmark_utils_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gtk/bookmark_menu_controller_gtk.h" 5 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "app/gtk_dnd_util.h"
10 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
11 #include "base/string_util.h" 10 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
14 #include "chrome/browser/bookmarks/bookmark_utils.h" 13 #include "chrome/browser/bookmarks/bookmark_utils.h"
15 #include "chrome/browser/gtk/bookmark_utils_gtk.h" 14 #include "chrome/browser/gtk/bookmark_utils_gtk.h"
16 #include "chrome/browser/gtk/gtk_chrome_button.h" 15 #include "chrome/browser/gtk/gtk_chrome_button.h"
17 #include "chrome/browser/gtk/gtk_theme_provider.h" 16 #include "chrome/browser/gtk/gtk_theme_provider.h"
18 #include "chrome/browser/gtk/gtk_util.h" 17 #include "chrome/browser/gtk/gtk_util.h"
19 #include "chrome/browser/gtk/menu_gtk.h" 18 #include "chrome/browser/gtk/menu_gtk.h"
20 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/tab_contents/page_navigator.h" 20 #include "chrome/browser/tab_contents/page_navigator.h"
22 #include "gfx/gtk_util.h" 21 #include "gfx/gtk_util.h"
23 #include "grit/app_resources.h" 22 #include "grit/app_resources.h"
24 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
25 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
25 #include "ui/base/dragdrop/gtk_dnd_util.h"
26 #include "webkit/glue/window_open_disposition.h" 26 #include "webkit/glue/window_open_disposition.h"
27 27
28 namespace { 28 namespace {
29 29
30 // TODO(estade): It might be a good idea to vary this by locale. 30 // TODO(estade): It might be a good idea to vary this by locale.
31 const int kMaxChars = 50; 31 const int kMaxChars = 50;
32 32
33 void SetImageMenuItem(GtkWidget* menu_item, 33 void SetImageMenuItem(GtkWidget* menu_item,
34 const BookmarkNode* node, 34 const BookmarkNode* node,
35 BookmarkModel* model) { 35 BookmarkModel* model) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } else if (node->is_folder()) { 171 } else if (node->is_folder()) {
172 GtkWidget* submenu = gtk_menu_new(); 172 GtkWidget* submenu = gtk_menu_new();
173 BuildMenu(node, 0, submenu); 173 BuildMenu(node, 0, submenu);
174 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); 174 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu);
175 } else { 175 } else {
176 NOTREACHED(); 176 NOTREACHED();
177 } 177 }
178 178
179 gtk_drag_source_set(menu_item, GDK_BUTTON1_MASK, NULL, 0, 179 gtk_drag_source_set(menu_item, GDK_BUTTON1_MASK, NULL, 0,
180 static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_LINK)); 180 static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_LINK));
181 int target_mask = gtk_dnd_util::CHROME_BOOKMARK_ITEM; 181 int target_mask = ui::CHROME_BOOKMARK_ITEM;
182 if (node->is_url()) 182 if (node->is_url())
183 target_mask |= gtk_dnd_util::TEXT_URI_LIST | gtk_dnd_util::NETSCAPE_URL; 183 target_mask |= ui::TEXT_URI_LIST | ui::NETSCAPE_URL;
184 gtk_dnd_util::SetSourceTargetListFromCodeMask(menu_item, target_mask); 184 ui::SetSourceTargetListFromCodeMask(menu_item, target_mask);
185 signals_.Connect(menu_item, "drag-begin", 185 signals_.Connect(menu_item, "drag-begin",
186 G_CALLBACK(OnMenuItemDragBeginThunk), this); 186 G_CALLBACK(OnMenuItemDragBeginThunk), this);
187 signals_.Connect(menu_item, "drag-end", 187 signals_.Connect(menu_item, "drag-end",
188 G_CALLBACK(OnMenuItemDragEndThunk), this); 188 G_CALLBACK(OnMenuItemDragEndThunk), this);
189 signals_.Connect(menu_item, "drag-data-get", 189 signals_.Connect(menu_item, "drag-data-get",
190 G_CALLBACK(OnMenuItemDragGetThunk), this); 190 G_CALLBACK(OnMenuItemDragGetThunk), this);
191 191
192 // It is important to connect to this signal after setting up the drag 192 // It is important to connect to this signal after setting up the drag
193 // source because we only want to stifle the menu's default handler and 193 // source because we only want to stifle the menu's default handler and
194 // not the handler that the drag source uses. 194 // not the handler that the drag source uses.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 367
368 void BookmarkMenuController::OnMenuItemDragGet( 368 void BookmarkMenuController::OnMenuItemDragGet(
369 GtkWidget* widget, GdkDragContext* context, 369 GtkWidget* widget, GdkDragContext* context,
370 GtkSelectionData* selection_data, 370 GtkSelectionData* selection_data,
371 guint target_type, guint time) { 371 guint target_type, guint time) {
372 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); 372 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget);
373 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, 373 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type,
374 profile_); 374 profile_);
375 } 375 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmark_bar_gtk.cc ('k') | chrome/browser/ui/gtk/bookmark_utils_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698