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