Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm

Issue 7572022: Use bookmark manager to add/edit bookmark pages with webui_dialogs=1. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Windows build compatibility. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 if (node->is_folder()) { 584 if (node->is_folder()) {
585 BookmarkNameFolderController* controller = 585 BookmarkNameFolderController* controller =
586 [[BookmarkNameFolderController alloc] 586 [[BookmarkNameFolderController alloc]
587 initWithParentWindow:[[self view] window] 587 initWithParentWindow:[[self view] window]
588 profile:browser_->profile() 588 profile:browser_->profile()
589 node:node]; 589 node:node];
590 [controller runAsModalSheet]; 590 [controller runAsModalSheet];
591 return; 591 return;
592 } 592 }
593 593
594 #if defined(WEBUI_DIALOGS)
595 browser_->OpenBookmarkManagerEditNode(node->id());
596 #else
594 // There is no real need to jump to a platform-common routine at 597 // 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 598 // this point (which just jumps back to objc) other than consistency
596 // across platforms. 599 // across platforms.
597 // 600 //
598 // TODO(jrg): identify when we NO_TREE. I can see it in the code 601 // 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 602 // for the other platforms but can't find a way to trigger it in the
600 // UI. 603 // UI.
601 BookmarkEditor::Show([[self view] window], 604 BookmarkEditor::Show([[self view] window],
602 browser_->profile(), 605 browser_->profile(),
603 node->parent(), 606 node->parent(),
604 BookmarkEditor::EditDetails(node), 607 BookmarkEditor::EditDetails(node),
605 BookmarkEditor::SHOW_TREE); 608 BookmarkEditor::SHOW_TREE);
609 #endif
606 } 610 }
607 611
608 - (IBAction)cutBookmark:(id)sender { 612 - (IBAction)cutBookmark:(id)sender {
609 const BookmarkNode* node = [self nodeFromMenuItem:sender]; 613 const BookmarkNode* node = [self nodeFromMenuItem:sender];
610 if (node) { 614 if (node) {
611 std::vector<const BookmarkNode*> nodes; 615 std::vector<const BookmarkNode*> nodes;
612 nodes.push_back(node); 616 nodes.push_back(node);
613 bookmark_utils::CopyToClipboard(bookmarkModel_, nodes, true); 617 bookmark_utils::CopyToClipboard(bookmarkModel_, nodes, true);
614 } 618 }
615 } 619 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 UserMetricsAction("OpenAllBookmarksIncognitoWindow")); 677 UserMetricsAction("OpenAllBookmarksIncognitoWindow"));
674 } 678 }
675 } 679 }
676 680
677 // May be called from the bar or from a folder button. 681 // May be called from the bar or from a folder button.
678 // If called from a button, that button becomes the parent. 682 // If called from a button, that button becomes the parent.
679 - (IBAction)addPage:(id)sender { 683 - (IBAction)addPage:(id)sender {
680 const BookmarkNode* parent = [self nodeFromMenuItem:sender]; 684 const BookmarkNode* parent = [self nodeFromMenuItem:sender];
681 if (!parent) 685 if (!parent)
682 parent = bookmarkModel_->bookmark_bar_node(); 686 parent = bookmarkModel_->bookmark_bar_node();
687 #if defined(WEBUI_DIALOGS)
688 browser_->OpenBookmarkManagerAddNodeIn(parent->id());
689 #else
683 BookmarkEditor::Show([[self view] window], 690 BookmarkEditor::Show([[self view] window],
684 browser_->profile(), 691 browser_->profile(),
685 parent, 692 parent,
686 BookmarkEditor::EditDetails(), 693 BookmarkEditor::EditDetails(),
687 BookmarkEditor::SHOW_TREE); 694 BookmarkEditor::SHOW_TREE);
695 #endif
688 } 696 }
689 697
690 // Might be called from the context menu over the bar OR over a 698 // Might be called from the context menu over the bar OR over a
691 // button. If called from a button, that button becomes a sibling of 699 // button. If called from a button, that button becomes a sibling of
692 // the new node. If called from the bar, add to the end of the bar. 700 // the new node. If called from the bar, add to the end of the bar.
693 - (IBAction)addFolder:(id)sender { 701 - (IBAction)addFolder:(id)sender {
694 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender]; 702 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender];
695 const BookmarkNode* parent = NULL; 703 const BookmarkNode* parent = NULL;
696 int newIndex = 0; 704 int newIndex = 0;
697 // If triggered from the bar, folder or "others" folder - add as a child to 705 // If triggered from the bar, folder or "others" folder - add as a child to
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2481 // to minimize touching the object passed in (likely a mock). 2489 // to minimize touching the object passed in (likely a mock).
2482 - (void)setButtonContextMenu:(id)menu { 2490 - (void)setButtonContextMenu:(id)menu {
2483 buttonContextMenu_ = menu; 2491 buttonContextMenu_ = menu;
2484 } 2492 }
2485 2493
2486 - (void)setIgnoreAnimations:(BOOL)ignore { 2494 - (void)setIgnoreAnimations:(BOOL)ignore {
2487 ignoreAnimations_ = ignore; 2495 ignoreAnimations_ = ignore;
2488 } 2496 }
2489 2497
2490 @end 2498 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698