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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc

Issue 10546116: gtk: Extract event functions into event_utils module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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/bookmarks/bookmark_bar_gtk.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/pickle.h" 12 #include "base/pickle.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/bookmarks/bookmark_model.h" 14 #include "chrome/browser/bookmarks/bookmark_model.h"
15 #include "chrome/browser/bookmarks/bookmark_node_data.h" 15 #include "chrome/browser/bookmarks/bookmark_node_data.h"
16 #include "chrome/browser/bookmarks/bookmark_utils.h" 16 #include "chrome/browser/bookmarks/bookmark_utils.h"
17 #include "chrome/browser/browser_shutdown.h" 17 #include "chrome/browser/browser_shutdown.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/ntp_background_util.h" 19 #include "chrome/browser/ntp_background_util.h"
20 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h" 23 #include "chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h"
24 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" 24 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
25 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 25 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
26 #include "chrome/browser/ui/gtk/custom_button.h" 26 #include "chrome/browser/ui/gtk/custom_button.h"
27 #include "chrome/browser/ui/gtk/event_utils.h"
27 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 28 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
28 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 29 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
29 #include "chrome/browser/ui/gtk/gtk_util.h" 30 #include "chrome/browser/ui/gtk/gtk_util.h"
30 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" 31 #include "chrome/browser/ui/gtk/hover_controller_gtk.h"
31 #include "chrome/browser/ui/gtk/menu_gtk.h" 32 #include "chrome/browser/ui/gtk/menu_gtk.h"
32 #include "chrome/browser/ui/gtk/rounded_window.h" 33 #include "chrome/browser/ui/gtk/rounded_window.h"
33 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h" 34 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h"
34 #include "chrome/browser/ui/gtk/view_id_util.h" 35 #include "chrome/browser/ui/gtk/view_id_util.h"
35 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 36 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
36 #include "chrome/common/chrome_notification_types.h" 37 #include "chrome/common/chrome_notification_types.h"
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 1143
1143 void BookmarkBarGtk::OnClicked(GtkWidget* sender) { 1144 void BookmarkBarGtk::OnClicked(GtkWidget* sender) {
1144 const BookmarkNode* node = GetNodeForToolButton(sender); 1145 const BookmarkNode* node = GetNodeForToolButton(sender);
1145 DCHECK(node); 1146 DCHECK(node);
1146 DCHECK(node->is_url()); 1147 DCHECK(node->is_url());
1147 DCHECK(page_navigator_); 1148 DCHECK(page_navigator_);
1148 1149
1149 Profile* profile = browser_->profile(); 1150 Profile* profile = browser_->profile();
1150 RecordAppLaunch(profile, node->url()); 1151 RecordAppLaunch(profile, node->url());
1151 bookmark_utils::OpenAll(window_->GetNativeWindow(), profile, page_navigator_, 1152 bookmark_utils::OpenAll(window_->GetNativeWindow(), profile, page_navigator_,
1152 node, gtk_util::DispositionForCurrentButtonPressEvent()); 1153 node, event_utils::DispositionForCurrentButtonPressEvent());
1153 1154
1154 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); 1155 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton"));
1155 } 1156 }
1156 1157
1157 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, 1158 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button,
1158 GdkDragContext* drag_context) { 1159 GdkDragContext* drag_context) {
1159 GtkWidget* button_parent = gtk_widget_get_parent(button); 1160 GtkWidget* button_parent = gtk_widget_get_parent(button);
1160 1161
1161 // The parent tool item might be removed during the drag. Ref it so |button| 1162 // The parent tool item might be removed during the drag. Ref it so |button|
1162 // won't get destroyed. 1163 // won't get destroyed.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { 1457 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() {
1457 GtkDestDefaults dest_defaults = 1458 GtkDestDefaults dest_defaults =
1458 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : 1459 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL :
1459 GTK_DEST_DEFAULT_DROP; 1460 GTK_DEST_DEFAULT_DROP;
1460 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); 1461 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction);
1461 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, 1462 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults,
1462 NULL, 0, kDragAction); 1463 NULL, 0, kDragAction);
1463 ui::SetDestTargetList(overflow_button_, kDestTargetList); 1464 ui::SetDestTargetList(overflow_button_, kDestTargetList);
1464 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); 1465 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList);
1465 } 1466 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/back_forward_button_gtk.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698