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

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

Issue 6931018: Initial implementation of "Synced Bookmarks" folder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge Created 9 years, 7 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
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 "app/mac/nsimage_cache.h" 7 #include "app/mac/nsimage_cache.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 - (BOOL)canEditBookmarks { 533 - (BOOL)canEditBookmarks {
534 PrefService* prefs = browser_->profile()->GetPrefs(); 534 PrefService* prefs = browser_->profile()->GetPrefs();
535 return prefs->GetBoolean(prefs::kEditBookmarksEnabled); 535 return prefs->GetBoolean(prefs::kEditBookmarksEnabled);
536 } 536 }
537 537
538 - (BOOL)canEditBookmark:(const BookmarkNode*)node { 538 - (BOOL)canEditBookmark:(const BookmarkNode*)node {
539 // Don't allow edit/delete of the bar node, or of "Other Bookmarks" 539 // Don't allow edit/delete of the bar node, or of "Other Bookmarks"
540 if ((node == nil) || 540 if ((node == nil) ||
541 (node == bookmarkModel_->other_node()) || 541 (node == bookmarkModel_->other_node()) ||
542 (node == bookmarkModel_->synced_node()) ||
542 (node == bookmarkModel_->GetBookmarkBarNode())) 543 (node == bookmarkModel_->GetBookmarkBarNode()))
543 return NO; 544 return NO;
544 return YES; 545 return YES;
545 } 546 }
546 547
547 #pragma mark Actions 548 #pragma mark Actions
548 549
549 // Helper methods called on the main thread by runMenuFlashThread. 550 // Helper methods called on the main thread by runMenuFlashThread.
550 551
551 - (void)setButtonFlashStateOn:(id)sender { 552 - (void)setButtonFlashStateOn:(id)sender {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 - (IBAction)addFolder:(id)sender { 794 - (IBAction)addFolder:(id)sender {
794 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender]; 795 const BookmarkNode* senderNode = [self nodeFromMenuItem:sender];
795 const BookmarkNode* parent = NULL; 796 const BookmarkNode* parent = NULL;
796 int newIndex = 0; 797 int newIndex = 0;
797 // If triggered from the bar, folder or "others" folder - add as a child to 798 // If triggered from the bar, folder or "others" folder - add as a child to
798 // the end. 799 // the end.
799 // If triggered from a bookmark, add as next sibling. 800 // If triggered from a bookmark, add as next sibling.
800 BookmarkNode::Type type = senderNode->type(); 801 BookmarkNode::Type type = senderNode->type();
801 if (type == BookmarkNode::BOOKMARK_BAR || 802 if (type == BookmarkNode::BOOKMARK_BAR ||
802 type == BookmarkNode::OTHER_NODE || 803 type == BookmarkNode::OTHER_NODE ||
804 type == BookmarkNode::SYNCED ||
803 type == BookmarkNode::FOLDER) { 805 type == BookmarkNode::FOLDER) {
804 parent = senderNode; 806 parent = senderNode;
805 newIndex = parent->child_count(); 807 newIndex = parent->child_count();
806 } else { 808 } else {
807 parent = senderNode->parent(); 809 parent = senderNode->parent();
808 newIndex = parent->GetIndexOf(senderNode) + 1; 810 newIndex = parent->GetIndexOf(senderNode) + 1;
809 } 811 }
810 BookmarkNameFolderController* controller = 812 BookmarkNameFolderController* controller =
811 [[BookmarkNameFolderController alloc] 813 [[BookmarkNameFolderController alloc]
812 initWithParentWindow:[[self view] window] 814 initWithParentWindow:[[self view] window]
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 // to minimize touching the object passed in (likely a mock). 2730 // to minimize touching the object passed in (likely a mock).
2729 - (void)setButtonContextMenu:(id)menu { 2731 - (void)setButtonContextMenu:(id)menu {
2730 buttonContextMenu_ = menu; 2732 buttonContextMenu_ = menu;
2731 } 2733 }
2732 2734
2733 - (void)setIgnoreAnimations:(BOOL)ignore { 2735 - (void)setIgnoreAnimations:(BOOL)ignore {
2734 ignoreAnimations_ = ignore; 2736 ignoreAnimations_ = ignore;
2735 } 2737 }
2736 2738
2737 @end 2739 @end
OLDNEW
« no previous file with comments | « chrome/browser/sync/protocol/sync.proto ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698