OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 initWithBookmarkBarController:self]); | 293 initWithBookmarkBarController:self]); |
294 | 294 |
295 // This call triggers an -awakeFromNib, which builds the bar, which might | 295 // This call triggers an -awakeFromNib, which builds the bar, which might |
296 // use |folderImage_| and |contextMenuController_|. Ensure it happens after | 296 // use |folderImage_| and |contextMenuController_|. Ensure it happens after |
297 // |folderImage_| is loaded and |contextMenuController_| is created. | 297 // |folderImage_| is loaded and |contextMenuController_| is created. |
298 [[self animatableView] setResizeDelegate:resizeDelegate]; | 298 [[self animatableView] setResizeDelegate:resizeDelegate]; |
299 } | 299 } |
300 return self; | 300 return self; |
301 } | 301 } |
302 | 302 |
303 - (void)browserWillBeDestroyed { | |
304 browser_ = nullptr; | |
305 } | |
306 | |
303 - (Browser*)browser { | 307 - (Browser*)browser { |
304 return browser_; | 308 return browser_; |
305 } | 309 } |
306 | 310 |
307 - (BookmarkContextMenuCocoaController*)menuController { | 311 - (BookmarkContextMenuCocoaController*)menuController { |
308 return contextMenuController_.get(); | 312 return contextMenuController_.get(); |
309 } | 313 } |
310 | 314 |
311 - (void)pulseBookmarkNotification:(NSNotification*)notification { | 315 - (void)pulseBookmarkNotification:(NSNotification*)notification { |
312 NSDictionary* dict = [notification userInfo]; | 316 NSDictionary* dict = [notification userInfo]; |
(...skipping 29 matching lines...) Expand all Loading... | |
342 return; | 346 return; |
343 } | 347 } |
344 if (node->parent() == bookmarkModel_->bookmark_bar_node()) { | 348 if (node->parent() == bookmarkModel_->bookmark_bar_node()) { |
345 [offTheSideButton_ setIsContinuousPulsing:doPulse]; | 349 [offTheSideButton_ setIsContinuousPulsing:doPulse]; |
346 return; | 350 return; |
347 } | 351 } |
348 | 352 |
349 NOTREACHED() << "no bookmark button found to pulse!"; | 353 NOTREACHED() << "no bookmark button found to pulse!"; |
350 } | 354 } |
351 | 355 |
352 - (void)dealloc { | 356 - (void)dealloc { |
tapted
2015/07/07 04:25:59
There's a dealloc hiding down here, and a curious
jackhou1
2015/07/07 08:33:05
Done.
| |
353 // Clear delegate so it doesn't get called during stopAnimation. | 357 // Clear delegate so it doesn't get called during stopAnimation. |
354 [[self animatableView] setResizeDelegate:nil]; | 358 [[self animatableView] setResizeDelegate:nil]; |
355 | 359 |
356 // We better stop any in-flight animation if we're being killed. | 360 // We better stop any in-flight animation if we're being killed. |
357 [[self animatableView] stopAnimation]; | 361 [[self animatableView] stopAnimation]; |
358 | 362 |
359 // Remove our view from its superview so it doesn't attempt to reference | 363 // Remove our view from its superview so it doesn't attempt to reference |
360 // it when the controller is gone. | 364 // it when the controller is gone. |
361 //TODO(dmaclach): Remove -- http://crbug.com/25845 | 365 //TODO(dmaclach): Remove -- http://crbug.com/25845 |
362 [[self view] removeFromSuperview]; | 366 [[self view] removeFromSuperview]; |
(...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2902 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2906 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
2903 (const BookmarkNode*)node { | 2907 (const BookmarkNode*)node { |
2904 // See if it's in the bar, then if it is in the hierarchy of visible | 2908 // See if it's in the bar, then if it is in the hierarchy of visible |
2905 // folder menus. | 2909 // folder menus. |
2906 if (bookmarkModel_->bookmark_bar_node() == node) | 2910 if (bookmarkModel_->bookmark_bar_node() == node) |
2907 return self; | 2911 return self; |
2908 return [folderController_ controllerForNode:node]; | 2912 return [folderController_ controllerForNode:node]; |
2909 } | 2913 } |
2910 | 2914 |
2911 @end | 2915 @end |
OLD | NEW |