| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #import "base/mac/bundle_locations.h" | 9 #import "base/mac/bundle_locations.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 if ([otherBookmarksButton_ bookmarkNode] == node) | 337 if ([otherBookmarksButton_ bookmarkNode] == node) |
| 338 return otherBookmarksButton_; | 338 return otherBookmarksButton_; |
| 339 | 339 |
| 340 if ([offTheSideButton_ bookmarkNode] == node) | 340 if ([offTheSideButton_ bookmarkNode] == node) |
| 341 return offTheSideButton_; | 341 return offTheSideButton_; |
| 342 | 342 |
| 343 if (node->parent() == bookmarkModel_->bookmark_bar_node()) { | 343 if (node->parent() == bookmarkModel_->bookmark_bar_node()) { |
| 344 for (BookmarkButton* button in [self buttons]) { | 344 for (BookmarkButton* button in [self buttons]) { |
| 345 if ([button bookmarkNode] == node) { | 345 if ([button bookmarkNode] == node) { |
| 346 [button setIsContinuousPulsing:YES]; | 346 [button setPulseIsStuckOn:YES]; |
| 347 return button; | 347 return button; |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 | 351 |
| 352 node = node->parent(); | 352 node = node->parent(); |
| 353 } | 353 } |
| 354 NOTREACHED(); | 354 NOTREACHED(); |
| 355 return nil; | 355 return nil; |
| 356 } | 356 } |
| 357 | 357 |
| 358 - (void)startPulsingBookmarkNode:(const BookmarkNode*)node { | 358 - (void)startPulsingBookmarkNode:(const BookmarkNode*)node { |
| 359 [self stopPulsingBookmarkNode]; | 359 [self stopPulsingBookmarkNode]; |
| 360 | 360 |
| 361 pulsingButton_ = [self bookmarkButtonToPulseForNode:node]; | 361 pulsingButton_ = [self bookmarkButtonToPulseForNode:node]; |
| 362 if (!pulsingButton_) | 362 if (!pulsingButton_) |
| 363 return; | 363 return; |
| 364 | 364 |
| 365 [pulsingButton_ setIsContinuousPulsing:YES]; | 365 [pulsingButton_ setPulseIsStuckOn:YES]; |
| 366 pulsingBookmarkObserver_.reset( | 366 pulsingBookmarkObserver_.reset( |
| 367 new BookmarkModelObserverForCocoa(bookmarkModel_, ^() { | 367 new BookmarkModelObserverForCocoa(bookmarkModel_, ^() { |
| 368 // Stop pulsing if anything happened to the node. | 368 // Stop pulsing if anything happened to the node. |
| 369 [self stopPulsingBookmarkNode]; | 369 [self stopPulsingBookmarkNode]; |
| 370 })); | 370 })); |
| 371 pulsingBookmarkObserver_->StartObservingNode(node); | 371 pulsingBookmarkObserver_->StartObservingNode(node); |
| 372 } | 372 } |
| 373 | 373 |
| 374 - (void)stopPulsingBookmarkNode { | 374 - (void)stopPulsingBookmarkNode { |
| 375 if (!pulsingButton_) | 375 if (!pulsingButton_) |
| 376 return; | 376 return; |
| 377 | 377 |
| 378 [pulsingButton_ setIsContinuousPulsing:NO]; | 378 [pulsingButton_ setPulseIsStuckOn:NO]; |
| 379 pulsingButton_ = nil; | 379 pulsingButton_ = nil; |
| 380 pulsingBookmarkObserver_.reset(); | 380 pulsingBookmarkObserver_.reset(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 - (void)dealloc { | 383 - (void)dealloc { |
| 384 [self browserWillBeDestroyed]; | 384 [self browserWillBeDestroyed]; |
| 385 [super dealloc]; | 385 [super dealloc]; |
| 386 } | 386 } |
| 387 | 387 |
| 388 - (void)browserWillBeDestroyed { | 388 - (void)browserWillBeDestroyed { |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2994 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2995 (const BookmarkNode*)node { | 2995 (const BookmarkNode*)node { |
| 2996 // See if it's in the bar, then if it is in the hierarchy of visible | 2996 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2997 // folder menus. | 2997 // folder menus. |
| 2998 if (bookmarkModel_->bookmark_bar_node() == node) | 2998 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2999 return self; | 2999 return self; |
| 3000 return [folderController_ controllerForNode:node]; | 3000 return [folderController_ controllerForNode:node]; |
| 3001 } | 3001 } |
| 3002 | 3002 |
| 3003 @end | 3003 @end |
| OLD | NEW |