Chromium Code Reviews| 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_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h" | |
| 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 13 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 14 #include "content/browser/user_metrics.h" | 15 #include "content/browser/user_metrics.h" |
| 15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "ui/base/l10n/l10n_util_mac.h" | 20 #include "ui/base/l10n/l10n_util_mac.h" |
| 20 | 21 |
| 21 | 22 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 // Watch to see if the parent window closes, and if so, close this one. | 100 // Watch to see if the parent window closes, and if so, close this one. |
| 100 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 101 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 101 [center addObserver:self | 102 [center addObserver:self |
| 102 selector:@selector(parentWindowWillClose:) | 103 selector:@selector(parentWindowWillClose:) |
| 103 name:NSWindowWillCloseNotification | 104 name:NSWindowWillCloseNotification |
| 104 object:parentWindow_]; | 105 object:parentWindow_]; |
| 105 } | 106 } |
| 106 return self; | 107 return self; |
| 107 } | 108 } |
| 108 | 109 |
| 110 - (void)awakeFromNib { | |
| 111 // Check if NSTextFieldCell supports the method. This check is in place as | |
| 112 // only 10.6 and greater support the setUsesSingleLineMode method. | |
|
mrossetti
2011/12/02 15:52:22
Add a TODO(kushalp): to this comment as you will w
| |
| 113 NSTextFieldCell* nameFieldCell_ = [nameTextField_ cell]; | |
| 114 if ([nameFieldCell_ | |
| 115 respondsToSelector:@selector(setUsesSingleLineMode:)]) { | |
| 116 [nameFieldCell_ setUsesSingleLineMode:YES]; | |
| 117 } | |
| 118 } | |
| 119 | |
| 109 - (void)dealloc { | 120 - (void)dealloc { |
| 110 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 121 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 111 [super dealloc]; | 122 [super dealloc]; |
| 112 } | 123 } |
| 113 | 124 |
| 114 // If this is a new bookmark somewhere visible (e.g. on the bookmark | 125 // If this is a new bookmark somewhere visible (e.g. on the bookmark |
| 115 // bar), pulse it. Else, call ourself recursively with our parent | 126 // bar), pulse it. Else, call ourself recursively with our parent |
| 116 // until we find something visible to pulse. | 127 // until we find something visible to pulse. |
| 117 - (void)startPulsingBookmarkButton:(const BookmarkNode*)node { | 128 - (void)startPulsingBookmarkButton:(const BookmarkNode*)node { |
| 118 while (node) { | 129 while (node) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; | 424 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; |
| 414 DCHECK(idx != -1); | 425 DCHECK(idx != -1); |
| 415 [folderPopUpButton_ selectItemAtIndex:idx]; | 426 [folderPopUpButton_ selectItemAtIndex:idx]; |
| 416 } | 427 } |
| 417 | 428 |
| 418 - (NSPopUpButton*)folderPopUpButton { | 429 - (NSPopUpButton*)folderPopUpButton { |
| 419 return folderPopUpButton_; | 430 return folderPopUpButton_; |
| 420 } | 431 } |
| 421 | 432 |
| 422 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) | 433 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) |
| OLD | NEW |