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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.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_button_cell.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #import "chrome/browser/bookmarks/bookmark_model.h" 9 #import "chrome/browser/bookmarks/bookmark_model.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h"
12 #import "chrome/browser/ui/cocoa/image_utils.h" 12 #import "chrome/browser/ui/cocoa/image_utils.h"
13 #include "content/browser/user_metrics.h" 13 #include "content/public/browser/user_metrics.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util_mac.h" 15 #include "ui/base/l10n/l10n_util_mac.h"
16 #include "ui/gfx/mac/nsimage_cache.h" 16 #include "ui/gfx/mac/nsimage_cache.h"
17 17
18 using content::UserMetricsAction;
19
18 20
19 @interface BookmarkButtonCell(Private) 21 @interface BookmarkButtonCell(Private)
20 - (void)configureBookmarkButtonCell; 22 - (void)configureBookmarkButtonCell;
21 - (void)applyTextColor; 23 - (void)applyTextColor;
22 @end 24 @end
23 25
24 26
25 @implementation BookmarkButtonCell 27 @implementation BookmarkButtonCell
26 28
27 @synthesize startingChildIndex = startingChildIndex_; 29 @synthesize startingChildIndex = startingChildIndex_;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // to disambiguate when needed (e.g. "open bookmark"), we set the 146 // to disambiguate when needed (e.g. "open bookmark"), we set the
145 // menu's associated bookmark node ID to be our represented object. 147 // menu's associated bookmark node ID to be our represented object.
146 - (NSMenu*)menu { 148 - (NSMenu*)menu {
147 if (empty_) 149 if (empty_)
148 return nil; 150 return nil;
149 BookmarkMenu* menu = (BookmarkMenu*)[super menu]; 151 BookmarkMenu* menu = (BookmarkMenu*)[super menu];
150 const BookmarkNode* node = 152 const BookmarkNode* node =
151 static_cast<const BookmarkNode*>([[self representedObject] pointerValue]); 153 static_cast<const BookmarkNode*>([[self representedObject] pointerValue]);
152 154
153 if (node->parent() && node->parent()->type() == BookmarkNode::FOLDER) { 155 if (node->parent() && node->parent()->type() == BookmarkNode::FOLDER) {
154 UserMetrics::RecordAction(UserMetricsAction("BookmarkBarFolder_CtxMenu")); 156 content::RecordAction(UserMetricsAction("BookmarkBarFolder_CtxMenu"));
155 } else { 157 } else {
156 UserMetrics::RecordAction(UserMetricsAction("BookmarkBar_CtxMenu")); 158 content::RecordAction(UserMetricsAction("BookmarkBar_CtxMenu"));
157 } 159 }
158 160
159 [menu setRepresentedObject:[NSNumber numberWithLongLong:node->id()]]; 161 [menu setRepresentedObject:[NSNumber numberWithLongLong:node->id()]];
160 162
161 return menu; 163 return menu;
162 } 164 }
163 165
164 - (void)setTitle:(NSString*)title { 166 - (void)setTitle:(NSString*)title {
165 if ([[self title] isEqualTo:title]) 167 if ([[self title] isEqualTo:title])
166 return; 168 return;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 NSRect drawRect = NSOffsetRect(imageRect, dX, dY); 248 NSRect drawRect = NSOffsetRect(imageRect, dX, dY);
247 [arrowImage_ drawInRect:drawRect 249 [arrowImage_ drawInRect:drawRect
248 fromRect:imageRect 250 fromRect:imageRect
249 operation:NSCompositeSourceOver 251 operation:NSCompositeSourceOver
250 fraction:[self isEnabled] ? 1.0 : 0.5 252 fraction:[self isEnabled] ? 1.0 : 0.5
251 neverFlipped:YES]; 253 neverFlipped:YES];
252 } 254 }
253 } 255 }
254 256
255 @end 257 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698