| 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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 if (node->is_folder()) { | 685 if (node->is_folder()) { |
| 686 BookmarkNameFolderController* controller = | 686 BookmarkNameFolderController* controller = |
| 687 [[BookmarkNameFolderController alloc] | 687 [[BookmarkNameFolderController alloc] |
| 688 initWithParentWindow:[[self view] window] | 688 initWithParentWindow:[[self view] window] |
| 689 profile:browser_->profile() | 689 profile:browser_->profile() |
| 690 node:node]; | 690 node:node]; |
| 691 [controller runAsModalSheet]; | 691 [controller runAsModalSheet]; |
| 692 return; | 692 return; |
| 693 } | 693 } |
| 694 | 694 |
| 695 #if defined(WEBUI_BOOKMARK_EDITOR) |
| 696 browser_->OpenBookmarkManagerEditNode(node->id()); |
| 697 #else |
| 695 // There is no real need to jump to a platform-common routine at | 698 // There is no real need to jump to a platform-common routine at |
| 696 // this point (which just jumps back to objc) other than consistency | 699 // this point (which just jumps back to objc) other than consistency |
| 697 // across platforms. | 700 // across platforms. |
| 698 // | 701 // |
| 699 // TODO(jrg): identify when we NO_TREE. I can see it in the code | 702 // TODO(jrg): identify when we NO_TREE. I can see it in the code |
| 700 // for the other platforms but can't find a way to trigger it in the | 703 // for the other platforms but can't find a way to trigger it in the |
| 701 // UI. | 704 // UI. |
| 702 BookmarkEditor::Show([[self view] window], | 705 BookmarkEditor::Show([[self view] window], |
| 703 browser_->profile(), | 706 browser_->profile(), |
| 704 node->parent(), | 707 node->parent(), |
| 705 BookmarkEditor::EditDetails(node), | 708 BookmarkEditor::EditDetails(node), |
| 706 BookmarkEditor::SHOW_TREE); | 709 BookmarkEditor::SHOW_TREE); |
| 710 #endif |
| 707 } | 711 } |
| 708 | 712 |
| 709 - (IBAction)cutBookmark:(id)sender { | 713 - (IBAction)cutBookmark:(id)sender { |
| 710 const BookmarkNode* node = [self nodeFromMenuItem:sender]; | 714 const BookmarkNode* node = [self nodeFromMenuItem:sender]; |
| 711 if (node) { | 715 if (node) { |
| 712 std::vector<const BookmarkNode*> nodes; | 716 std::vector<const BookmarkNode*> nodes; |
| 713 nodes.push_back(node); | 717 nodes.push_back(node); |
| 714 bookmark_utils::CopyToClipboard(bookmarkModel_, nodes, true); | 718 bookmark_utils::CopyToClipboard(bookmarkModel_, nodes, true); |
| 715 } | 719 } |
| 716 } | 720 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); | 778 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); |
| 775 } | 779 } |
| 776 } | 780 } |
| 777 | 781 |
| 778 // May be called from the bar or from a folder button. | 782 // May be called from the bar or from a folder button. |
| 779 // If called from a button, that button becomes the parent. | 783 // If called from a button, that button becomes the parent. |
| 780 - (IBAction)addPage:(id)sender { | 784 - (IBAction)addPage:(id)sender { |
| 781 const BookmarkNode* parent = [self nodeFromMenuItem:sender]; | 785 const BookmarkNode* parent = [self nodeFromMenuItem:sender]; |
| 782 if (!parent) | 786 if (!parent) |
| 783 parent = bookmarkModel_->bookmark_bar_node(); | 787 parent = bookmarkModel_->bookmark_bar_node(); |
| 788 #if defined(WEBUI_BOOKMARK_EDITOR) |
| 789 browser_->OpenBookmarkManagerAddNodeIn(parent->id()); |
| 790 #else |
| 784 BookmarkEditor::Show([[self view] window], | 791 BookmarkEditor::Show([[self view] window], |
| 785 browser_->profile(), | 792 browser_->profile(), |
| 786 parent, | 793 parent, |
| 787 BookmarkEditor::EditDetails(), | 794 BookmarkEditor::EditDetails(), |
| 788 BookmarkEditor::SHOW_TREE); | 795 BookmarkEditor::SHOW_TREE); |
| 796 #endif |
| 789 } | 797 } |
| 790 | 798 |
| 791 // Might be called from the context menu over the bar OR over a | 799 // Might be called from the context menu over the bar OR over a |
| 792 // button. If called from a button, that button becomes a sibling of | 800 // button. If called from a button, that button becomes a sibling of |
| 793 // the new node. If called from the bar, add to the end of the bar. | 801 // the new node. If called from the bar, add to the end of the bar. |
| 794 - (IBAction)addFolder:(id)sender { | 802 - (IBAction)addFolder:(id)sender { |
| 795 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender]; | 803 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender]; |
| 796 const BookmarkNode* parent = NULL; | 804 const BookmarkNode* parent = NULL; |
| 797 int newIndex = 0; | 805 int newIndex = 0; |
| 798 // If triggered from the bar, folder or "others" folder - add as a child to | 806 // If triggered from the bar, folder or "others" folder - add as a child to |
| (...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 // to minimize touching the object passed in (likely a mock). | 2768 // to minimize touching the object passed in (likely a mock). |
| 2761 - (void)setButtonContextMenu:(id)menu { | 2769 - (void)setButtonContextMenu:(id)menu { |
| 2762 buttonContextMenu_ = menu; | 2770 buttonContextMenu_ = menu; |
| 2763 } | 2771 } |
| 2764 | 2772 |
| 2765 - (void)setIgnoreAnimations:(BOOL)ignore { | 2773 - (void)setIgnoreAnimations:(BOOL)ignore { |
| 2766 ignoreAnimations_ = ignore; | 2774 ignoreAnimations_ = ignore; |
| 2767 } | 2775 } |
| 2768 | 2776 |
| 2769 @end | 2777 @end |
| OLD | NEW |