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

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

Issue 306293006: Introduce ChromeBookmarkClientFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@364865
Patch Set: Add missing dependency in components/policy/policy_browser.gypi Created 6 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stack> 5 #include <stack>
6 6
7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h" 7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h"
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/bundle_locations.h" 11 #include "base/mac/bundle_locations.h"
12 #include "base/mac/mac_util.h" 12 #include "base/mac/mac_util.h"
13 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
15 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" 15 #include "chrome/browser/bookmarks/chrome_bookmark_client.h"
16 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h" 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h"
18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h"
19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h" 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h"
20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_tree_browser_cell.h" 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_tree_browser_cell.h"
21 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 22 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
22 #include "components/bookmarks/browser/bookmark_model.h" 23 #include "components/bookmarks/browser/bookmark_model.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/l10n/l10n_util_mac.h" 26 #include "ui/base/l10n/l10n_util_mac.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 498 }
498 ++i; 499 ++i;
499 } 500 }
500 } 501 }
501 DCHECK([path length] == stackSize); 502 DCHECK([path length] == stackSize);
502 return path; 503 return path;
503 } 504 }
504 505
505 - (NSMutableArray*)addChildFoldersFromNode:(const BookmarkNode*)node { 506 - (NSMutableArray*)addChildFoldersFromNode:(const BookmarkNode*)node {
506 ChromeBookmarkClient* client = 507 ChromeBookmarkClient* client =
507 BookmarkModelFactory::GetChromeBookmarkClientForProfile(profile_); 508 ChromeBookmarkClientFactory::GetForProfile(profile_);
508 NSMutableArray* childFolders = nil; 509 NSMutableArray* childFolders = nil;
509 int childCount = node->child_count(); 510 int childCount = node->child_count();
510 for (int i = 0; i < childCount; ++i) { 511 for (int i = 0; i < childCount; ++i) {
511 const BookmarkNode* childNode = node->GetChild(i); 512 const BookmarkNode* childNode = node->GetChild(i);
512 if (childNode->is_folder() && childNode->IsVisible() && 513 if (childNode->is_folder() && childNode->IsVisible() &&
513 client->CanBeEditedByUser(childNode)) { 514 client->CanBeEditedByUser(childNode)) {
514 NSString* childName = base::SysUTF16ToNSString(childNode->GetTitle()); 515 NSString* childName = base::SysUTF16ToNSString(childNode->GetTitle());
515 NSMutableArray* children = [self addChildFoldersFromNode:childNode]; 516 NSMutableArray* children = [self addChildFoldersFromNode:childNode];
516 BookmarkFolderInfo* folderInfo = 517 BookmarkFolderInfo* folderInfo =
517 [BookmarkFolderInfo bookmarkFolderInfoWithFolderName:childName 518 [BookmarkFolderInfo bookmarkFolderInfoWithFolderName:childName
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 714 }
714 715
715 // Implementing isEqual: allows the NSTreeController to preserve the selection 716 // Implementing isEqual: allows the NSTreeController to preserve the selection
716 // and open/shut state of outline items when the data changes. 717 // and open/shut state of outline items when the data changes.
717 - (BOOL)isEqual:(id)other { 718 - (BOOL)isEqual:(id)other {
718 return [other isKindOfClass:[BookmarkFolderInfo class]] && 719 return [other isKindOfClass:[BookmarkFolderInfo class]] &&
719 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; 720 folderNode_ == [(BookmarkFolderInfo*)other folderNode];
720 } 721 }
721 722
722 @end 723 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698