| 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_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 + (NSString*)chooseAnotherFolderString { | 371 + (NSString*)chooseAnotherFolderString { |
| 372 return l10n_util::GetNSStringWithFixup( | 372 return l10n_util::GetNSStringWithFixup( |
| 373 IDS_BOOMARK_BUBBLE_CHOOSER_ANOTHER_FOLDER); | 373 IDS_BOOMARK_BUBBLE_CHOOSER_ANOTHER_FOLDER); |
| 374 } | 374 } |
| 375 | 375 |
| 376 // For the given folder node, walk the tree and add folder names to | 376 // For the given folder node, walk the tree and add folder names to |
| 377 // the given pop up button. | 377 // the given pop up button. |
| 378 - (void)addFolderNodes:(const BookmarkNode*)parent | 378 - (void)addFolderNodes:(const BookmarkNode*)parent |
| 379 toPopUpButton:(NSPopUpButton*)button | 379 toPopUpButton:(NSPopUpButton*)button |
| 380 indentation:(int)indentation { | 380 indentation:(int)indentation { |
| 381 if (!model_->is_root(parent)) { | 381 if (!model_->is_root_node(parent)) { |
| 382 NSString* title = base::SysUTF16ToNSString(parent->GetTitle()); | 382 NSString* title = base::SysUTF16ToNSString(parent->GetTitle()); |
| 383 NSMenu* menu = [button menu]; | 383 NSMenu* menu = [button menu]; |
| 384 NSMenuItem* item = [menu addItemWithTitle:title | 384 NSMenuItem* item = [menu addItemWithTitle:title |
| 385 action:NULL | 385 action:NULL |
| 386 keyEquivalent:@""]; | 386 keyEquivalent:@""]; |
| 387 [item setRepresentedObject:[NSValue valueWithPointer:parent]]; | 387 [item setRepresentedObject:[NSValue valueWithPointer:parent]]; |
| 388 [item setIndentationLevel:indentation]; | 388 [item setIndentationLevel:indentation]; |
| 389 ++indentation; | 389 ++indentation; |
| 390 } | 390 } |
| 391 for (int i = 0; i < parent->child_count(); i++) { | 391 for (int i = 0; i < parent->child_count(); i++) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 412 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; | 412 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; |
| 413 DCHECK(idx != -1); | 413 DCHECK(idx != -1); |
| 414 [folderPopUpButton_ selectItemAtIndex:idx]; | 414 [folderPopUpButton_ selectItemAtIndex:idx]; |
| 415 } | 415 } |
| 416 | 416 |
| 417 - (NSPopUpButton*)folderPopUpButton { | 417 - (NSPopUpButton*)folderPopUpButton { |
| 418 return folderPopUpButton_; | 418 return folderPopUpButton_; |
| 419 } | 419 } |
| 420 | 420 |
| 421 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) | 421 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) |
| OLD | NEW |