Chromium Code Reviews| 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/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2364 const BookmarkNode* sourceNode = *it; | 2364 const BookmarkNode* sourceNode = *it; |
| 2365 dragged = [self dragBookmark:sourceNode to:dropPoint copy:copy]; | 2365 dragged = [self dragBookmark:sourceNode to:dropPoint copy:copy]; |
| 2366 } | 2366 } |
| 2367 } | 2367 } |
| 2368 return dragged; | 2368 return dragged; |
| 2369 } | 2369 } |
| 2370 | 2370 |
| 2371 - (std::vector<const BookmarkNode*>)retrieveBookmarkNodeData { | 2371 - (std::vector<const BookmarkNode*>)retrieveBookmarkNodeData { |
| 2372 std::vector<const BookmarkNode*> dragDataNodes; | 2372 std::vector<const BookmarkNode*> dragDataNodes; |
| 2373 BookmarkNodeData dragData; | 2373 BookmarkNodeData dragData; |
| 2374 if(dragData.ReadFromDragClipboard()) { | 2374 if (dragData.ReadFromDragClipboard()) { |
| 2375 BookmarkModel* bookmarkModel = [self bookmarkModel]; | 2375 std::vector<const BookmarkNode*> nodes( |
| 2376 Profile* profile = bookmarkModel->profile(); | 2376 dragData.GetNodes(browser_->profile())); |
| 2377 std::vector<const BookmarkNode*> nodes(dragData.GetNodes(profile)); | |
| 2378 dragDataNodes.assign(nodes.begin(), nodes.end()); | 2377 dragDataNodes.assign(nodes.begin(), nodes.end()); |
| 2379 } | 2378 } |
| 2380 return dragDataNodes; | 2379 return dragDataNodes; |
| 2381 } | 2380 } |
| 2382 | 2381 |
| 2383 // Return YES if we should show the drop indicator, else NO. | 2382 // Return YES if we should show the drop indicator, else NO. |
| 2384 - (BOOL)shouldShowIndicatorShownForPoint:(NSPoint)point { | 2383 - (BOOL)shouldShowIndicatorShownForPoint:(NSPoint)point { |
| 2385 return ![self buttonForDroppingOnAtPoint:point]; | 2384 return ![self buttonForDroppingOnAtPoint:point]; |
| 2386 } | 2385 } |
| 2387 | 2386 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2463 withAnimation:NO | 2462 withAnimation:NO |
| 2464 delay:NO]; | 2463 delay:NO]; |
| 2465 | 2464 |
| 2466 if (folderController_) | 2465 if (folderController_) |
| 2467 [self closeAllBookmarkFolders]; | 2466 [self closeAllBookmarkFolders]; |
| 2468 | 2467 |
| 2469 // Folder controller, like many window controllers, owns itself. | 2468 // Folder controller, like many window controllers, owns itself. |
| 2470 folderController_ = | 2469 folderController_ = |
| 2471 [[BookmarkBarFolderController alloc] initWithParentButton:parentButton | 2470 [[BookmarkBarFolderController alloc] initWithParentButton:parentButton |
| 2472 parentController:nil | 2471 parentController:nil |
| 2473 barController:self]; | 2472 barController:self |
| 2473 profile:browser_->profile()]; | |
|
Alexei Svitkine (slow)
2013/03/27 15:16:39
Align :'s. If it doesn't fit, add a newline before
tfarina
2013/03/27 21:02:27
Done.
| |
| 2474 [folderController_ showWindow:self]; | 2474 [folderController_ showWindow:self]; |
| 2475 | 2475 |
| 2476 // Only BookmarkBarController has this; the | 2476 // Only BookmarkBarController has this; the |
| 2477 // BookmarkBarFolderController does not. | 2477 // BookmarkBarFolderController does not. |
| 2478 [self watchForExitEvent:YES]; | 2478 [self watchForExitEvent:YES]; |
| 2479 | 2479 |
| 2480 // No longer need to hold the lock; the folderController_ now owns it. | 2480 // No longer need to hold the lock; the folderController_ now owns it. |
| 2481 [browserController releaseBarVisibilityForOwner:self | 2481 [browserController releaseBarVisibilityForOwner:self |
| 2482 withAnimation:NO | 2482 withAnimation:NO |
| 2483 delay:NO]; | 2483 delay:NO]; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2633 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2633 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2634 (const BookmarkNode*)node { | 2634 (const BookmarkNode*)node { |
| 2635 // See if it's in the bar, then if it is in the hierarchy of visible | 2635 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2636 // folder menus. | 2636 // folder menus. |
| 2637 if (bookmarkModel_->bookmark_bar_node() == node) | 2637 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2638 return self; | 2638 return self; |
| 2639 return [folderController_ controllerForNode:node]; | 2639 return [folderController_ controllerForNode:node]; |
| 2640 } | 2640 } |
| 2641 | 2641 |
| 2642 @end | 2642 @end |
| OLD | NEW |