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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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) 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_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"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" 29 #include "chrome/browser/ui/gtk/hover_controller_gtk.h"
30 #include "chrome/browser/ui/gtk/menu_gtk.h" 30 #include "chrome/browser/ui/gtk/menu_gtk.h"
31 #include "chrome/browser/ui/gtk/rounded_window.h" 31 #include "chrome/browser/ui/gtk/rounded_window.h"
32 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h" 32 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h"
33 #include "chrome/browser/ui/gtk/view_id_util.h" 33 #include "chrome/browser/ui/gtk/view_id_util.h"
34 #include "chrome/common/chrome_notification_types.h" 34 #include "chrome/common/chrome_notification_types.h"
35 #include "chrome/common/extensions/extension_constants.h" 35 #include "chrome/common/extensions/extension_constants.h"
36 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
37 #include "content/browser/tab_contents/tab_contents.h" 37 #include "content/browser/tab_contents/tab_contents.h"
38 #include "content/browser/tab_contents/tab_contents_view.h" 38 #include "content/browser/tab_contents/tab_contents_view.h"
39 #include "content/browser/user_metrics.h"
40 #include "content/public/browser/notification_details.h" 39 #include "content/public/browser/notification_details.h"
41 #include "content/public/browser/notification_source.h" 40 #include "content/public/browser/notification_source.h"
41 #include "content/public/browser/user_metrics.h"
42 #include "grit/generated_resources.h" 42 #include "grit/generated_resources.h"
43 #include "grit/theme_resources.h" 43 #include "grit/theme_resources.h"
44 #include "grit/ui_resources.h" 44 #include "grit/ui_resources.h"
45 #include "ui/base/dragdrop/drag_drop_types.h" 45 #include "ui/base/dragdrop/drag_drop_types.h"
46 #include "ui/base/dragdrop/gtk_dnd_util.h" 46 #include "ui/base/dragdrop/gtk_dnd_util.h"
47 #include "ui/base/l10n/l10n_util.h" 47 #include "ui/base/l10n/l10n_util.h"
48 #include "ui/base/resource/resource_bundle.h" 48 #include "ui/base/resource/resource_bundle.h"
49 #include "ui/gfx/canvas_skia_paint.h" 49 #include "ui/gfx/canvas_skia_paint.h"
50 #include "ui/gfx/gtk_util.h" 50 #include "ui/gfx/gtk_util.h"
51 #include "ui/gfx/image/cairo_cached_surface.h" 51 #include "ui/gfx/image/cairo_cached_surface.h"
52 #include "ui/gfx/image/image.h" 52 #include "ui/gfx/image/image.h"
53 53
54 using content::UserMetricsAction;
55
54 namespace { 56 namespace {
55 57
56 // The showing height of the bar. 58 // The showing height of the bar.
57 const int kBookmarkBarHeight = 29; 59 const int kBookmarkBarHeight = 29;
58 60
59 // Padding for when the bookmark bar is detached. 61 // Padding for when the bookmark bar is detached.
60 const int kTopBottomNTPPadding = 12; 62 const int kTopBottomNTPPadding = 12;
61 const int kLeftRightNTPPadding = 8; 63 const int kLeftRightNTPPadding = 8;
62 64
63 // Padding around the bar's content area when the bookmark bar is detached. 65 // Padding around the bar's content area when the bookmark bar is detached.
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 const BookmarkNode* node = GetNodeForToolButton(sender); 1130 const BookmarkNode* node = GetNodeForToolButton(sender);
1129 DCHECK(node); 1131 DCHECK(node);
1130 DCHECK(node->is_url()); 1132 DCHECK(node->is_url());
1131 DCHECK(page_navigator_); 1133 DCHECK(page_navigator_);
1132 1134
1133 Profile* profile = browser_->profile(); 1135 Profile* profile = browser_->profile();
1134 RecordAppLaunch(profile, node->url()); 1136 RecordAppLaunch(profile, node->url());
1135 bookmark_utils::OpenAll(window_->GetNativeHandle(), profile, page_navigator_, 1137 bookmark_utils::OpenAll(window_->GetNativeHandle(), profile, page_navigator_,
1136 node, gtk_util::DispositionForCurrentButtonPressEvent()); 1138 node, gtk_util::DispositionForCurrentButtonPressEvent());
1137 1139
1138 UserMetrics::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); 1140 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton"));
1139 } 1141 }
1140 1142
1141 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, 1143 void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button,
1142 GdkDragContext* drag_context) { 1144 GdkDragContext* drag_context) {
1143 // The parent tool item might be removed during the drag. Ref it so |button| 1145 // The parent tool item might be removed during the drag. Ref it so |button|
1144 // won't get destroyed. 1146 // won't get destroyed.
1145 g_object_ref(button->parent); 1147 g_object_ref(button->parent);
1146 1148
1147 const BookmarkNode* node = GetNodeForToolButton(button); 1149 const BookmarkNode* node = GetNodeForToolButton(button);
1148 DCHECK(!dragged_node_); 1150 DCHECK(!dragged_node_);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { 1438 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() {
1437 GtkDestDefaults dest_defaults = 1439 GtkDestDefaults dest_defaults =
1438 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : 1440 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL :
1439 GTK_DEST_DEFAULT_DROP; 1441 GTK_DEST_DEFAULT_DROP;
1440 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); 1442 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction);
1441 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, 1443 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults,
1442 NULL, 0, kDragAction); 1444 NULL, 0, kDragAction);
1443 ui::SetDestTargetList(overflow_button_, kDestTargetList); 1445 ui::SetDestTargetList(overflow_button_, kDestTargetList);
1444 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); 1446 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList);
1445 } 1447 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/fullscreen_controller.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698