| 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/memory/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #import "chrome/browser/app_controller_mac.h" | 9 #import "chrome/browser/app_controller_mac.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/browser_iterator.h" | 15 #include "chrome/browser/ui/browser_iterator.h" |
| 16 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" | 16 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" |
| 17 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" | 17 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" |
| 18 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" | 18 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" |
| 19 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" | 19 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" |
| 20 | 20 |
| 21 @implementation BrowserCrApplication (AppleScriptAdditions) | 21 @implementation BrowserCrApplication (AppleScriptAdditions) |
| 22 | 22 |
| 23 - (NSArray*)appleScriptWindows { | 23 - (NSArray*)appleScriptWindows { |
| 24 NSMutableArray* appleScriptWindows = [NSMutableArray | 24 NSMutableArray* appleScriptWindows = [NSMutableArray |
| 25 arrayWithCapacity:chrome::GetTotalBrowserCount()]; | 25 arrayWithCapacity:chrome::GetTotalBrowserCount()]; |
| 26 // Iterate through all browsers and check if it closing, | 26 // Iterate through all browsers and check if it closing, |
| 27 // if not add it to list. | 27 // if not add it to list. |
| 28 for (chrome::BrowserIterator browserIterator; !browserIterator.done(); | 28 for (chrome::BrowserIterator browserIterator; !browserIterator.done(); |
| 29 browserIterator.Next()) { | 29 browserIterator.Next()) { |
| 30 if ((*browserIterator)->IsAttemptingToCloseBrowser()) | 30 if ((*browserIterator)->IsAttemptingToCloseBrowser()) |
| 31 continue; | 31 continue; |
| 32 | 32 |
| 33 scoped_nsobject<WindowAppleScript> window( | 33 base::scoped_nsobject<WindowAppleScript> window( |
| 34 [[WindowAppleScript alloc] initWithBrowser:*browserIterator]); | 34 [[WindowAppleScript alloc] initWithBrowser:*browserIterator]); |
| 35 [window setContainer:NSApp | 35 [window setContainer:NSApp |
| 36 property:AppleScript::kWindowsProperty]; | 36 property:AppleScript::kWindowsProperty]; |
| 37 [appleScriptWindows addObject:window]; | 37 [appleScriptWindows addObject:window]; |
| 38 } | 38 } |
| 39 // Windows sorted by their index value, which is obtained by calling | 39 // Windows sorted by their index value, which is obtained by calling |
| 40 // orderedIndex: on each window. | 40 // orderedIndex: on each window. |
| 41 [appleScriptWindows sortUsingSelector:@selector(windowComparator:)]; | 41 [appleScriptWindows sortUsingSelector:@selector(windowComparator:)]; |
| 42 return appleScriptWindows; | 42 return appleScriptWindows; |
| 43 } | 43 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 - (void)insertInBookmarksFolders:(id)aBookmarkFolder atIndex:(int)index { | 131 - (void)insertInBookmarksFolders:(id)aBookmarkFolder atIndex:(int)index { |
| 132 NOTIMPLEMENTED(); | 132 NOTIMPLEMENTED(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 - (void)removeFromBookmarksFoldersAtIndex:(int)index { | 135 - (void)removeFromBookmarksFoldersAtIndex:(int)index { |
| 136 NOTIMPLEMENTED(); | 136 NOTIMPLEMENTED(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 @end | 139 @end |
| OLD | NEW |