| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h" | 5 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/foundation_util.h" | 8 #import "base/mac/foundation_util.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 - (BookmarkFolderAppleScript*)otherBookmarks { | 74 - (BookmarkFolderAppleScript*)otherBookmarks { |
| 75 AppController* appDelegate = | 75 AppController* appDelegate = |
| 76 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); | 76 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); |
| 77 | 77 |
| 78 Profile* lastProfile = [appDelegate lastProfile]; | 78 Profile* lastProfile = [appDelegate lastProfile]; |
| 79 if (!lastProfile) { | 79 if (!lastProfile) { |
| 80 AppleScript::SetError(AppleScript::errGetProfile); | 80 AppleScript::SetError(AppleScript::errGetProfile); |
| 81 return nil; | 81 return nil; |
| 82 } | 82 } |
| 83 | 83 |
| 84 BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile); | 84 BookmarkModel* model = |
| 85 BookmarkModelFactory::GetForBrowserContext(lastProfile); |
| 85 if (!model->loaded()) { | 86 if (!model->loaded()) { |
| 86 AppleScript::SetError(AppleScript::errBookmarkModelLoad); | 87 AppleScript::SetError(AppleScript::errBookmarkModelLoad); |
| 87 return nil; | 88 return nil; |
| 88 } | 89 } |
| 89 | 90 |
| 90 BookmarkFolderAppleScript* otherBookmarks = | 91 BookmarkFolderAppleScript* otherBookmarks = |
| 91 [[[BookmarkFolderAppleScript alloc] | 92 [[[BookmarkFolderAppleScript alloc] |
| 92 initWithBookmarkNode:model->other_node()] autorelease]; | 93 initWithBookmarkNode:model->other_node()] autorelease]; |
| 93 [otherBookmarks setContainer:self | 94 [otherBookmarks setContainer:self |
| 94 property:AppleScript::kBookmarkFoldersProperty]; | 95 property:AppleScript::kBookmarkFoldersProperty]; |
| 95 return otherBookmarks; | 96 return otherBookmarks; |
| 96 } | 97 } |
| 97 | 98 |
| 98 - (BookmarkFolderAppleScript*)bookmarksBar { | 99 - (BookmarkFolderAppleScript*)bookmarksBar { |
| 99 AppController* appDelegate = | 100 AppController* appDelegate = |
| 100 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); | 101 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); |
| 101 | 102 |
| 102 Profile* lastProfile = [appDelegate lastProfile]; | 103 Profile* lastProfile = [appDelegate lastProfile]; |
| 103 if (!lastProfile) { | 104 if (!lastProfile) { |
| 104 AppleScript::SetError(AppleScript::errGetProfile); | 105 AppleScript::SetError(AppleScript::errGetProfile); |
| 105 return nil; | 106 return nil; |
| 106 } | 107 } |
| 107 | 108 |
| 108 BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile); | 109 BookmarkModel* model = |
| 110 BookmarkModelFactory::GetForBrowserContext(lastProfile); |
| 109 if (!model->loaded()) { | 111 if (!model->loaded()) { |
| 110 AppleScript::SetError(AppleScript::errBookmarkModelLoad); | 112 AppleScript::SetError(AppleScript::errBookmarkModelLoad); |
| 111 return NULL; | 113 return NULL; |
| 112 } | 114 } |
| 113 | 115 |
| 114 BookmarkFolderAppleScript* bookmarksBar = | 116 BookmarkFolderAppleScript* bookmarksBar = |
| 115 [[[BookmarkFolderAppleScript alloc] | 117 [[[BookmarkFolderAppleScript alloc] |
| 116 initWithBookmarkNode:model->bookmark_bar_node()] autorelease]; | 118 initWithBookmarkNode:model->bookmark_bar_node()] autorelease]; |
| 117 [bookmarksBar setContainer:self | 119 [bookmarksBar setContainer:self |
| 118 property:AppleScript::kBookmarkFoldersProperty]; | 120 property:AppleScript::kBookmarkFoldersProperty]; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 134 | 136 |
| 135 - (void)insertInBookmarksFolders:(id)aBookmarkFolder atIndex:(int)index { | 137 - (void)insertInBookmarksFolders:(id)aBookmarkFolder atIndex:(int)index { |
| 136 NOTIMPLEMENTED(); | 138 NOTIMPLEMENTED(); |
| 137 } | 139 } |
| 138 | 140 |
| 139 - (void)removeFromBookmarksFoldersAtIndex:(int)index { | 141 - (void)removeFromBookmarksFoldersAtIndex:(int)index { |
| 140 NOTIMPLEMENTED(); | 142 NOTIMPLEMENTED(); |
| 141 } | 143 } |
| 142 | 144 |
| 143 @end | 145 @end |
| OLD | NEW |