OLD | NEW |
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/metrics/user_metrics.h" |
8 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 10 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_context_menu_cocoa_controlle
r.h" | 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_context_menu_cocoa_controlle
r.h" |
12 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
13 #import "components/bookmarks/browser/bookmark_model.h" | 14 #import "components/bookmarks/browser/bookmark_model.h" |
14 #include "content/public/browser/user_metrics.h" | |
15 #import "ui/base/cocoa/nsview_additions.h" | 15 #import "ui/base/cocoa/nsview_additions.h" |
16 #include "ui/base/l10n/l10n_util_mac.h" | 16 #include "ui/base/l10n/l10n_util_mac.h" |
17 #include "ui/base/material_design/material_design_controller.h" | 17 #include "ui/base/material_design/material_design_controller.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/resources/grit/ui_resources.h" | 19 #include "ui/resources/grit/ui_resources.h" |
20 | 20 |
21 using base::UserMetricsAction; | 21 using base::UserMetricsAction; |
22 using bookmarks::BookmarkNode; | 22 using bookmarks::BookmarkNode; |
23 | 23 |
24 namespace { | 24 namespace { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 pointerValue]); | 253 pointerValue]); |
254 } | 254 } |
255 | 255 |
256 - (NSMenu*)menu { | 256 - (NSMenu*)menu { |
257 // If node is NULL, this is a custom button, the menu does not represent | 257 // If node is NULL, this is a custom button, the menu does not represent |
258 // anything. | 258 // anything. |
259 const BookmarkNode* node = [self bookmarkNode]; | 259 const BookmarkNode* node = [self bookmarkNode]; |
260 | 260 |
261 if (node && node->parent() && | 261 if (node && node->parent() && |
262 node->parent()->type() == BookmarkNode::FOLDER) { | 262 node->parent()->type() == BookmarkNode::FOLDER) { |
263 content::RecordAction(UserMetricsAction("BookmarkBarFolder_CtxMenu")); | 263 base::RecordAction(UserMetricsAction("BookmarkBarFolder_CtxMenu")); |
264 } else { | 264 } else { |
265 content::RecordAction(UserMetricsAction("BookmarkBar_CtxMenu")); | 265 base::RecordAction(UserMetricsAction("BookmarkBar_CtxMenu")); |
266 } | 266 } |
267 return [menuController_ menuForBookmarkNode:node]; | 267 return [menuController_ menuForBookmarkNode:node]; |
268 } | 268 } |
269 | 269 |
270 - (void)setTitle:(NSString*)title { | 270 - (void)setTitle:(NSString*)title { |
271 if ([[self title] isEqualTo:title]) | 271 if ([[self title] isEqualTo:title]) |
272 return; | 272 return; |
273 [super setTitle:title]; | 273 [super setTitle:title]; |
274 [self applyTextColor]; | 274 [self applyTextColor]; |
275 } | 275 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 const CGFloat kLineWidth = [controlView cr_lineWidth]; | 436 const CGFloat kLineWidth = [controlView cr_lineWidth]; |
437 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] && | 437 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] && |
438 kLineWidth < 1) { | 438 kLineWidth < 1) { |
439 return -kLineWidth; | 439 return -kLineWidth; |
440 } | 440 } |
441 return 0.0; | 441 return 0.0; |
442 } | 442 } |
443 | 443 |
444 | 444 |
445 @end | 445 @end |
OLD | NEW |