| 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/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 9 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
| 14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 15 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" | 16 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" |
| 16 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" | 17 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" |
| 17 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" | 18 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 - (void)removeFromAppleScriptWindowsAtIndex:(int)index { | 65 - (void)removeFromAppleScriptWindowsAtIndex:(int)index { |
| 65 [[[self appleScriptWindows] objectAtIndex:index] | 66 [[[self appleScriptWindows] objectAtIndex:index] |
| 66 handlesCloseScriptCommand:nil]; | 67 handlesCloseScriptCommand:nil]; |
| 67 } | 68 } |
| 68 | 69 |
| 69 - (NSScriptObjectSpecifier*)objectSpecifier { | 70 - (NSScriptObjectSpecifier*)objectSpecifier { |
| 70 return nil; | 71 return nil; |
| 71 } | 72 } |
| 72 | 73 |
| 73 - (BookmarkFolderAppleScript*)otherBookmarks { | 74 - (BookmarkFolderAppleScript*)otherBookmarks { |
| 74 AppController* appDelegate = [NSApp delegate]; | 75 AppController* appDelegate = |
| 76 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); |
| 75 | 77 |
| 76 Profile* lastProfile = [appDelegate lastProfile]; | 78 Profile* lastProfile = [appDelegate lastProfile]; |
| 77 if (!lastProfile) { | 79 if (!lastProfile) { |
| 78 AppleScript::SetError(AppleScript::errGetProfile); | 80 AppleScript::SetError(AppleScript::errGetProfile); |
| 79 return nil; | 81 return nil; |
| 80 } | 82 } |
| 81 | 83 |
| 82 BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile); | 84 BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile); |
| 83 if (!model->loaded()) { | 85 if (!model->loaded()) { |
| 84 AppleScript::SetError(AppleScript::errBookmarkModelLoad); | 86 AppleScript::SetError(AppleScript::errBookmarkModelLoad); |
| 85 return nil; | 87 return nil; |
| 86 } | 88 } |
| 87 | 89 |
| 88 BookmarkFolderAppleScript* otherBookmarks = | 90 BookmarkFolderAppleScript* otherBookmarks = |
| 89 [[[BookmarkFolderAppleScript alloc] | 91 [[[BookmarkFolderAppleScript alloc] |
| 90 initWithBookmarkNode:model->other_node()] autorelease]; | 92 initWithBookmarkNode:model->other_node()] autorelease]; |
| 91 [otherBookmarks setContainer:self | 93 [otherBookmarks setContainer:self |
| 92 property:AppleScript::kBookmarkFoldersProperty]; | 94 property:AppleScript::kBookmarkFoldersProperty]; |
| 93 return otherBookmarks; | 95 return otherBookmarks; |
| 94 } | 96 } |
| 95 | 97 |
| 96 - (BookmarkFolderAppleScript*)bookmarksBar { | 98 - (BookmarkFolderAppleScript*)bookmarksBar { |
| 97 AppController* appDelegate = [NSApp delegate]; | 99 AppController* appDelegate = |
| 100 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); |
| 98 | 101 |
| 99 Profile* lastProfile = [appDelegate lastProfile]; | 102 Profile* lastProfile = [appDelegate lastProfile]; |
| 100 if (!lastProfile) { | 103 if (!lastProfile) { |
| 101 AppleScript::SetError(AppleScript::errGetProfile); | 104 AppleScript::SetError(AppleScript::errGetProfile); |
| 102 return nil; | 105 return nil; |
| 103 } | 106 } |
| 104 | 107 |
| 105 BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile); | 108 BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile); |
| 106 if (!model->loaded()) { | 109 if (!model->loaded()) { |
| 107 AppleScript::SetError(AppleScript::errBookmarkModelLoad); | 110 AppleScript::SetError(AppleScript::errBookmarkModelLoad); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 131 | 134 |
| 132 - (void)insertInBookmarksFolders:(id)aBookmarkFolder atIndex:(int)index { | 135 - (void)insertInBookmarksFolders:(id)aBookmarkFolder atIndex:(int)index { |
| 133 NOTIMPLEMENTED(); | 136 NOTIMPLEMENTED(); |
| 134 } | 137 } |
| 135 | 138 |
| 136 - (void)removeFromBookmarksFoldersAtIndex:(int)index { | 139 - (void)removeFromBookmarksFoldersAtIndex:(int)index { |
| 137 NOTIMPLEMENTED(); | 140 NOTIMPLEMENTED(); |
| 138 } | 141 } |
| 139 | 142 |
| 140 @end | 143 @end |
| OLD | NEW |