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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.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/views/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/ui/views/frame/browser_view.h" 32 #include "chrome/browser/ui/views/frame/browser_view.h"
33 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 33 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
34 #include "chrome/common/chrome_notification_types.h" 34 #include "chrome/common/chrome_notification_types.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/extensions/extension_constants.h" 36 #include "chrome/common/extensions/extension_constants.h"
37 #include "chrome/common/pref_names.h" 37 #include "chrome/common/pref_names.h"
38 #include "content/browser/renderer_host/render_view_host.h" 38 #include "content/browser/renderer_host/render_view_host.h"
39 #include "content/browser/renderer_host/render_widget_host_view.h" 39 #include "content/browser/renderer_host/render_widget_host_view.h"
40 #include "content/browser/tab_contents/page_navigator.h" 40 #include "content/browser/tab_contents/page_navigator.h"
41 #include "content/browser/tab_contents/tab_contents.h" 41 #include "content/browser/tab_contents/tab_contents.h"
42 #include "content/browser/user_metrics.h"
43 #include "content/public/browser/notification_details.h" 42 #include "content/public/browser/notification_details.h"
44 #include "content/public/browser/notification_source.h" 43 #include "content/public/browser/notification_source.h"
44 #include "content/public/browser/user_metrics.h"
45 #include "content/public/common/page_transition_types.h" 45 #include "content/public/common/page_transition_types.h"
46 #include "grit/generated_resources.h" 46 #include "grit/generated_resources.h"
47 #include "grit/theme_resources.h" 47 #include "grit/theme_resources.h"
48 #include "grit/ui_resources.h" 48 #include "grit/ui_resources.h"
49 #include "ui/base/accessibility/accessible_view_state.h" 49 #include "ui/base/accessibility/accessible_view_state.h"
50 #include "ui/base/animation/slide_animation.h" 50 #include "ui/base/animation/slide_animation.h"
51 #include "ui/base/dragdrop/os_exchange_data.h" 51 #include "ui/base/dragdrop/os_exchange_data.h"
52 #include "ui/base/l10n/l10n_util.h" 52 #include "ui/base/l10n/l10n_util.h"
53 #include "ui/base/resource/resource_bundle.h" 53 #include "ui/base/resource/resource_bundle.h"
54 #include "ui/base/text/text_elider.h" 54 #include "ui/base/text/text_elider.h"
55 #include "ui/gfx/canvas_skia.h" 55 #include "ui/gfx/canvas_skia.h"
56 #include "ui/views/controls/button/menu_button.h" 56 #include "ui/views/controls/button/menu_button.h"
57 #include "ui/views/controls/label.h" 57 #include "ui/views/controls/label.h"
58 #include "ui/views/controls/menu/menu_item_view.h" 58 #include "ui/views/controls/menu/menu_item_view.h"
59 #include "ui/views/drag_utils.h" 59 #include "ui/views/drag_utils.h"
60 #include "ui/views/metrics.h" 60 #include "ui/views/metrics.h"
61 #include "ui/views/view_constants.h" 61 #include "ui/views/view_constants.h"
62 #include "ui/views/widget/tooltip_manager.h" 62 #include "ui/views/widget/tooltip_manager.h"
63 #include "ui/views/widget/widget.h" 63 #include "ui/views/widget/widget.h"
64 64
65 using content::UserMetricsAction;
65 using views::CustomButton; 66 using views::CustomButton;
66 using views::DropTargetEvent; 67 using views::DropTargetEvent;
67 using views::MenuButton; 68 using views::MenuButton;
68 using views::MenuItemView; 69 using views::MenuItemView;
69 using views::View; 70 using views::View;
70 71
71 // How much we want the bookmark bar to overlap the toolbar when in its 72 // How much we want the bookmark bar to overlap the toolbar when in its
72 // 'always shown' mode. 73 // 'always shown' mode.
73 static const int kToolbarOverlap = 3; 74 static const int kToolbarOverlap = 3;
74 75
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 } 921 }
921 922
922 void BookmarkBarView::BookmarkNodeFaviconChanged(BookmarkModel* model, 923 void BookmarkBarView::BookmarkNodeFaviconChanged(BookmarkModel* model,
923 const BookmarkNode* node) { 924 const BookmarkNode* node) {
924 BookmarkNodeChangedImpl(model, node); 925 BookmarkNodeChangedImpl(model, node);
925 } 926 }
926 927
927 void BookmarkBarView::WriteDragDataForView(View* sender, 928 void BookmarkBarView::WriteDragDataForView(View* sender,
928 const gfx::Point& press_pt, 929 const gfx::Point& press_pt,
929 ui::OSExchangeData* data) { 930 ui::OSExchangeData* data) {
930 UserMetrics::RecordAction(UserMetricsAction("BookmarkBar_DragButton")); 931 content::RecordAction(UserMetricsAction("BookmarkBar_DragButton"));
931 932
932 for (int i = 0; i < GetBookmarkButtonCount(); ++i) { 933 for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
933 if (sender == GetBookmarkButton(i)) { 934 if (sender == GetBookmarkButton(i)) {
934 views::TextButton* button = GetBookmarkButton(i); 935 views::TextButton* button = GetBookmarkButton(i);
935 gfx::CanvasSkia canvas(button->width(), button->height(), false); 936 gfx::CanvasSkia canvas(button->width(), button->height(), false);
936 button->PaintButton(&canvas, views::TextButton::PB_FOR_DRAG); 937 button->PaintButton(&canvas, views::TextButton::PB_FOR_DRAG);
937 drag_utils::SetDragImageOnDataObject(canvas, button->size(), press_pt, 938 drag_utils::SetDragImageOnDataObject(canvas, button->size(), press_pt,
938 data); 939 data);
939 WriteBookmarkDragData(model_->bookmark_bar_node()->GetChild(i), data); 940 WriteBookmarkDragData(model_->bookmark_bar_node()->GetChild(i), data);
940 return; 941 return;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 page_navigator_->OpenURL(node->url(), GURL(), 1032 page_navigator_->OpenURL(node->url(), GURL(),
1032 disposition_from_event_flags, content::PAGE_TRANSITION_AUTO_BOOKMARK); 1033 disposition_from_event_flags, content::PAGE_TRANSITION_AUTO_BOOKMARK);
1033 } else { 1034 } else {
1034 bookmark_utils::OpenAll(GetWidget()->GetNativeWindow(), profile, 1035 bookmark_utils::OpenAll(GetWidget()->GetNativeWindow(), profile,
1035 page_navigator_, node, disposition_from_event_flags); 1036 page_navigator_, node, disposition_from_event_flags);
1036 } 1037 }
1037 1038
1038 bookmark_utils::RecordBookmarkLaunch(IsDetached() ? 1039 bookmark_utils::RecordBookmarkLaunch(IsDetached() ?
1039 bookmark_utils::LAUNCH_DETACHED_BAR : 1040 bookmark_utils::LAUNCH_DETACHED_BAR :
1040 bookmark_utils::LAUNCH_ATTACHED_BAR); 1041 bookmark_utils::LAUNCH_ATTACHED_BAR);
1041 UserMetrics::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); 1042 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton"));
1042 } 1043 }
1043 1044
1044 void BookmarkBarView::ShowContextMenuForView(View* source, 1045 void BookmarkBarView::ShowContextMenuForView(View* source,
1045 const gfx::Point& p, 1046 const gfx::Point& p,
1046 bool is_mouse_gesture) { 1047 bool is_mouse_gesture) {
1047 if (!model_->IsLoaded()) { 1048 if (!model_->IsLoaded()) {
1048 // Don't do anything if the model isn't loaded. 1049 // Don't do anything if the model isn't loaded.
1049 return; 1050 return;
1050 } 1051 }
1051 1052
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 (1 - size_animation_->GetCurrentValue()))); 1656 (1 - size_animation_->GetCurrentValue())));
1656 } else { 1657 } else {
1657 prefsize.set_height( 1658 prefsize.set_height(
1658 static_cast<int>( 1659 static_cast<int>(
1659 browser_defaults::kBookmarkBarHeight * 1660 browser_defaults::kBookmarkBarHeight *
1660 size_animation_->GetCurrentValue())); 1661 size_animation_->GetCurrentValue()));
1661 } 1662 }
1662 } 1663 }
1663 return prefsize; 1664 return prefsize;
1664 } 1665 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/about_chrome_view.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698