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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm

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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_editor.h" 10 #include "chrome/browser/bookmarks/bookmark_editor.h"
(...skipping 25 matching lines...) Expand all
36 #import "chrome/browser/ui/cocoa/menu_button.h" 36 #import "chrome/browser/ui/cocoa/menu_button.h"
37 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" 37 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
38 #import "chrome/browser/ui/cocoa/themed_window.h" 38 #import "chrome/browser/ui/cocoa/themed_window.h"
39 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 39 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
40 #import "chrome/browser/ui/cocoa/view_id_util.h" 40 #import "chrome/browser/ui/cocoa/view_id_util.h"
41 #import "chrome/browser/ui/cocoa/view_resizer.h" 41 #import "chrome/browser/ui/cocoa/view_resizer.h"
42 #include "chrome/common/extensions/extension_constants.h" 42 #include "chrome/common/extensions/extension_constants.h"
43 #include "chrome/common/pref_names.h" 43 #include "chrome/common/pref_names.h"
44 #include "content/browser/tab_contents/tab_contents.h" 44 #include "content/browser/tab_contents/tab_contents.h"
45 #include "content/browser/tab_contents/tab_contents_view.h" 45 #include "content/browser/tab_contents/tab_contents_view.h"
46 #include "content/browser/user_metrics.h" 46 #include "content/public/browser/user_metrics.h"
47 #include "grit/generated_resources.h" 47 #include "grit/generated_resources.h"
48 #include "grit/theme_resources.h" 48 #include "grit/theme_resources.h"
49 #include "grit/ui_resources.h" 49 #include "grit/ui_resources.h"
50 #include "skia/ext/skia_utils_mac.h" 50 #include "skia/ext/skia_utils_mac.h"
51 #include "ui/base/l10n/l10n_util_mac.h" 51 #include "ui/base/l10n/l10n_util_mac.h"
52 #include "ui/base/resource/resource_bundle.h" 52 #include "ui/base/resource/resource_bundle.h"
53 #include "ui/gfx/image/image.h" 53 #include "ui/gfx/image/image.h"
54 #include "ui/gfx/mac/nsimage_cache.h" 54 #include "ui/gfx/mac/nsimage_cache.h"
55 55
56 using content::UserMetricsAction;
57
56 // Bookmark bar state changing and animations 58 // Bookmark bar state changing and animations
57 // 59 //
58 // The bookmark bar has three real states: "showing" (a normal bar attached to 60 // The bookmark bar has three real states: "showing" (a normal bar attached to
59 // the toolbar), "hidden", and "detached" (pretending to be part of the web 61 // the toolbar), "hidden", and "detached" (pretending to be part of the web
60 // content on the NTP). It can, or at least should be able to, animate between 62 // content on the NTP). It can, or at least should be able to, animate between
61 // these states. There are several complications even without animation: 63 // these states. There are several complications even without animation:
62 // - The placement of the bookmark bar is done by the BWC, and it needs to know 64 // - The placement of the bookmark bar is done by the BWC, and it needs to know
63 // the state in order to place the bookmark bar correctly (immediately below 65 // the state in order to place the bookmark bar correctly (immediately below
64 // the toolbar when showing, below the infobar when detached). 66 // the toolbar when showing, below the infobar when detached).
65 // - The "divider" (a black line) needs to be drawn by either the toolbar (when 67 // - The "divider" (a black line) needs to be drawn by either the toolbar (when
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 if (node) { 745 if (node) {
744 bookmarkModel_->Remove(node->parent(), 746 bookmarkModel_->Remove(node->parent(),
745 node->parent()->GetIndexOf(node)); 747 node->parent()->GetIndexOf(node));
746 } 748 }
747 } 749 }
748 750
749 - (IBAction)openAllBookmarks:(id)sender { 751 - (IBAction)openAllBookmarks:(id)sender {
750 const BookmarkNode* node = [self nodeFromMenuItem:sender]; 752 const BookmarkNode* node = [self nodeFromMenuItem:sender];
751 if (node) { 753 if (node) {
752 [self openAll:node disposition:NEW_FOREGROUND_TAB]; 754 [self openAll:node disposition:NEW_FOREGROUND_TAB];
753 UserMetrics::RecordAction(UserMetricsAction("OpenAllBookmarks")); 755 content::RecordAction(UserMetricsAction("OpenAllBookmarks"));
754 } 756 }
755 } 757 }
756 758
757 - (IBAction)openAllBookmarksNewWindow:(id)sender { 759 - (IBAction)openAllBookmarksNewWindow:(id)sender {
758 const BookmarkNode* node = [self nodeFromMenuItem:sender]; 760 const BookmarkNode* node = [self nodeFromMenuItem:sender];
759 if (node) { 761 if (node) {
760 [self openAll:node disposition:NEW_WINDOW]; 762 [self openAll:node disposition:NEW_WINDOW];
761 UserMetrics::RecordAction(UserMetricsAction("OpenAllBookmarksNewWindow")); 763 content::RecordAction(UserMetricsAction("OpenAllBookmarksNewWindow"));
762 } 764 }
763 } 765 }
764 766
765 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { 767 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender {
766 const BookmarkNode* node = [self nodeFromMenuItem:sender]; 768 const BookmarkNode* node = [self nodeFromMenuItem:sender];
767 if (node) { 769 if (node) {
768 [self openAll:node disposition:OFF_THE_RECORD]; 770 [self openAll:node disposition:OFF_THE_RECORD];
769 UserMetrics::RecordAction( 771 content::RecordAction(
770 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); 772 UserMetricsAction("OpenAllBookmarksIncognitoWindow"));
771 } 773 }
772 } 774 }
773 775
774 // May be called from the bar or from a folder button. 776 // May be called from the bar or from a folder button.
775 // If called from a button, that button becomes the parent. 777 // If called from a button, that button becomes the parent.
776 - (IBAction)addPage:(id)sender { 778 - (IBAction)addPage:(id)sender {
777 const BookmarkNode* parent = [self nodeFromMenuItem:sender]; 779 const BookmarkNode* parent = [self nodeFromMenuItem:sender];
778 if (!parent) 780 if (!parent)
779 parent = bookmarkModel_->bookmark_bar_node(); 781 parent = bookmarkModel_->bookmark_bar_node();
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 // to minimize touching the object passed in (likely a mock). 2778 // to minimize touching the object passed in (likely a mock).
2777 - (void)setButtonContextMenu:(id)menu { 2779 - (void)setButtonContextMenu:(id)menu {
2778 buttonContextMenu_ = menu; 2780 buttonContextMenu_ = menu;
2779 } 2781 }
2780 2782
2781 - (void)setIgnoreAnimations:(BOOL)ignore { 2783 - (void)setIgnoreAnimations:(BOOL)ignore {
2782 ignoreAnimations_ = ignore; 2784 ignoreAnimations_ = ignore;
2783 } 2785 }
2784 2786
2785 @end 2787 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698