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

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

Issue 345045: Bookmark context menu "Edit" starts with current name, not "New Folder".... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "app/l10n_util_mac.h" 5 #include "app/l10n_util_mac.h"
6 #include "app/resource_bundle.h" 6 #include "app/resource_bundle.h"
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_editor.h" 9 #include "chrome/browser/bookmarks/bookmark_editor.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 475 }
476 476
477 - (IBAction)openBookmarkInIncognitoWindow:(id)sender { 477 - (IBAction)openBookmarkInIncognitoWindow:(id)sender {
478 BookmarkNode* node = [self nodeFromMenuItem:sender]; 478 BookmarkNode* node = [self nodeFromMenuItem:sender];
479 [urlDelegate_ openBookmarkURL:node->GetURL() disposition:OFF_THE_RECORD]; 479 [urlDelegate_ openBookmarkURL:node->GetURL() disposition:OFF_THE_RECORD];
480 } 480 }
481 481
482 - (IBAction)editBookmark:(id)sender { 482 - (IBAction)editBookmark:(id)sender {
483 BookmarkNode* node = [self nodeFromMenuItem:sender]; 483 BookmarkNode* node = [self nodeFromMenuItem:sender];
484 484
485 // TODO(jrg): on windows, folder "buttons" use the bar's context
486 // menu (but with extra items enabled, like Rename). For now we do
487 // a cheat and redirect so we have the functionality available.
488 if (node->is_folder()) { 485 if (node->is_folder()) {
489 [self addOrRenameFolder:sender]; 486 BookmarkNameFolderController* controller =
487 [[BookmarkNameFolderController alloc]
488 initWithParentWindow:[[self view] window]
489 profile:browser_->profile()
490 node:node];
491 [controller runAsModalSheet];
490 return; 492 return;
491 } 493 }
492 494
493 // There is no real need to jump to a platform-common routine at 495 // There is no real need to jump to a platform-common routine at
494 // this point (which just jumps back to objc) other than consistency 496 // this point (which just jumps back to objc) other than consistency
495 // across platforms. 497 // across platforms.
496 // 498 //
497 // TODO(jrg): identify when we NO_TREE. I can see it in the code 499 // TODO(jrg): identify when we NO_TREE. I can see it in the code
498 // for the other platforms but can't find a way to trigger it in the 500 // for the other platforms but can't find a way to trigger it in the
499 // UI. 501 // UI.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 parent = bookmarkModel_->GetBookmarkBarNode(); 552 parent = bookmarkModel_->GetBookmarkBarNode();
551 BookmarkEditor::Show([[self view] window], 553 BookmarkEditor::Show([[self view] window],
552 browser_->profile(), 554 browser_->profile(),
553 parent, 555 parent,
554 BookmarkEditor::EditDetails(), 556 BookmarkEditor::EditDetails(),
555 BookmarkEditor::SHOW_TREE, 557 BookmarkEditor::SHOW_TREE,
556 nil); 558 nil);
557 } 559 }
558 560
559 // Might be from the context menu over the bar OR over a button. 561 // Might be from the context menu over the bar OR over a button.
560 - (IBAction)addOrRenameFolder:(id)sender { 562 - (IBAction)addFolder:(id)sender {
561 // node is NULL if we were invoked from the bar, and that's fine.
562 BookmarkNode* node = [self nodeFromMenuItem:sender];
563 BookmarkNameFolderController* controller = 563 BookmarkNameFolderController* controller =
564 [[BookmarkNameFolderController alloc] 564 [[BookmarkNameFolderController alloc]
565 initWithParentWindow:[[self view] window] 565 initWithParentWindow:[[self view] window]
566 profile:browser_->profile() 566 profile:browser_->profile()
567 node:node]; 567 node:NULL];
568 [controller runAsModalSheet]; 568 [controller runAsModalSheet];
569
570 // runAsModalSheet will run the window as a sheet. The
571 // BookmarkNameFolderController will release itself when the sheet
572 // ends.
573 } 569 }
574 570
575 - (BookmarkBarView*)buttonView { 571 - (BookmarkBarView*)buttonView {
576 return buttonView_; 572 return buttonView_;
577 } 573 }
578 574
579 // Delete all buttons (bookmarks, chevron, "other bookmarks") from the 575 // Delete all buttons (bookmarks, chevron, "other bookmarks") from the
580 // bookmark bar; reset knowledge of bookmarks. 576 // bookmark bar; reset knowledge of bookmarks.
581 - (void)clearBookmarkBar { 577 - (void)clearBookmarkBar {
582 [buttons_ makeObjectsPerformSelector:@selector(removeFromSuperview)]; 578 [buttons_ makeObjectsPerformSelector:@selector(removeFromSuperview)];
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 899
904 - (NSButton*)offTheSideButton { 900 - (NSButton*)offTheSideButton {
905 return offTheSideButton_; 901 return offTheSideButton_;
906 } 902 }
907 903
908 - (NSButton*)otherBookmarksButton { 904 - (NSButton*)otherBookmarksButton {
909 return otherBookmarksButton_.get(); 905 return otherBookmarksButton_.get();
910 } 906 }
911 907
912 @end 908 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.h ('k') | chrome/browser/cocoa/bookmark_name_folder_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698