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_bar_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 if (node->is_folder()) { | 581 if (node->is_folder()) { |
582 BookmarkNameFolderController* controller = | 582 BookmarkNameFolderController* controller = |
583 [[BookmarkNameFolderController alloc] | 583 [[BookmarkNameFolderController alloc] |
584 initWithParentWindow:[[self view] window] | 584 initWithParentWindow:[[self view] window] |
585 profile:browser_->profile() | 585 profile:browser_->profile() |
586 node:node]; | 586 node:node]; |
587 [controller runAsModalSheet]; | 587 [controller runAsModalSheet]; |
588 return; | 588 return; |
589 } | 589 } |
590 | 590 |
591 #if defined(WEBUI_DIALOGS) | 591 // This jumps to a platform-common routine at this point (which may just |
592 browser_->OpenBookmarkManagerEditNode(node->id()); | 592 // jump back to objc or may use the WebUI dialog). |
593 #else | |
594 // There is no real need to jump to a platform-common routine at | |
595 // this point (which just jumps back to objc) other than consistency | |
596 // across platforms. | |
597 // | 593 // |
598 // TODO(jrg): identify when we NO_TREE. I can see it in the code | 594 // TODO(jrg): identify when we NO_TREE. I can see it in the code |
599 // for the other platforms but can't find a way to trigger it in the | 595 // for the other platforms but can't find a way to trigger it in the |
600 // UI. | 596 // UI. |
601 BookmarkEditor::Show([[self view] window], | 597 BookmarkEditor::Show([[self view] window], |
602 browser_->profile(), | 598 browser_->profile(), |
603 node->parent(), | 599 BookmarkEditor::EditDetails::EditNode(node), |
604 BookmarkEditor::EditDetails(node), | |
605 BookmarkEditor::SHOW_TREE); | 600 BookmarkEditor::SHOW_TREE); |
606 #endif | |
607 } | 601 } |
608 | 602 |
609 - (IBAction)cutBookmark:(id)sender { | 603 - (IBAction)cutBookmark:(id)sender { |
610 const BookmarkNode* node = [self nodeFromMenuItem:sender]; | 604 const BookmarkNode* node = [self nodeFromMenuItem:sender]; |
611 if (node) { | 605 if (node) { |
612 std::vector<const BookmarkNode*> nodes; | 606 std::vector<const BookmarkNode*> nodes; |
613 nodes.push_back(node); | 607 nodes.push_back(node); |
614 bookmark_utils::CopyToClipboard(bookmarkModel_, nodes, true); | 608 bookmark_utils::CopyToClipboard(bookmarkModel_, nodes, true); |
615 } | 609 } |
616 } | 610 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); | 668 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); |
675 } | 669 } |
676 } | 670 } |
677 | 671 |
678 // May be called from the bar or from a folder button. | 672 // May be called from the bar or from a folder button. |
679 // If called from a button, that button becomes the parent. | 673 // If called from a button, that button becomes the parent. |
680 - (IBAction)addPage:(id)sender { | 674 - (IBAction)addPage:(id)sender { |
681 const BookmarkNode* parent = [self nodeFromMenuItem:sender]; | 675 const BookmarkNode* parent = [self nodeFromMenuItem:sender]; |
682 if (!parent) | 676 if (!parent) |
683 parent = bookmarkModel_->bookmark_bar_node(); | 677 parent = bookmarkModel_->bookmark_bar_node(); |
684 #if defined(WEBUI_DIALOGS) | |
685 browser_->OpenBookmarkManagerAddNodeIn(parent->id()); | |
686 #else | |
687 BookmarkEditor::Show([[self view] window], | 678 BookmarkEditor::Show([[self view] window], |
688 browser_->profile(), | 679 browser_->profile(), |
689 parent, | 680 BookmarkEditor::EditDetails::AddNodeInFolder(parent), |
690 BookmarkEditor::EditDetails(), | |
691 BookmarkEditor::SHOW_TREE); | 681 BookmarkEditor::SHOW_TREE); |
692 #endif | |
693 } | 682 } |
694 | 683 |
695 // Might be called from the context menu over the bar OR over a | 684 // Might be called from the context menu over the bar OR over a |
696 // button. If called from a button, that button becomes a sibling of | 685 // button. If called from a button, that button becomes a sibling of |
697 // the new node. If called from the bar, add to the end of the bar. | 686 // the new node. If called from the bar, add to the end of the bar. |
698 - (IBAction)addFolder:(id)sender { | 687 - (IBAction)addFolder:(id)sender { |
699 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender]; | 688 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender]; |
700 const BookmarkNode* parent = NULL; | 689 const BookmarkNode* parent = NULL; |
701 int newIndex = 0; | 690 int newIndex = 0; |
702 // If triggered from the bar, folder or "others" folder - add as a child to | 691 // If triggered from the bar, folder or "others" folder - add as a child to |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 // to minimize touching the object passed in (likely a mock). | 2479 // to minimize touching the object passed in (likely a mock). |
2491 - (void)setButtonContextMenu:(id)menu { | 2480 - (void)setButtonContextMenu:(id)menu { |
2492 buttonContextMenu_ = menu; | 2481 buttonContextMenu_ = menu; |
2493 } | 2482 } |
2494 | 2483 |
2495 - (void)setIgnoreAnimations:(BOOL)ignore { | 2484 - (void)setIgnoreAnimations:(BOOL)ignore { |
2496 ignoreAnimations_ = ignore; | 2485 ignoreAnimations_ = ignore; |
2497 } | 2486 } |
2498 | 2487 |
2499 @end | 2488 @end |
OLD | NEW |