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