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

Side by Side Diff: chrome/browser/ui/cocoa/applescript/window_applescript.mm

Issue 12212120: Replace most BrowserList::empty() and BrowserList::size() calls by multi-desktop aware calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r182110 Created 7 years, 10 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 | Annotate | Revision Log
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 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" 5 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/memory/scoped_nsobject.h" 8 #import "base/memory/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #import "chrome/browser/app_controller_mac.h" 11 #import "chrome/browser/app_controller_mac.h"
12 #import "chrome/browser/chrome_browser_application_mac.h" 12 #import "chrome/browser/chrome_browser_application_mac.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_commands.h" 15 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_navigator.h" 17 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/browser_tabstrip.h" 18 #include "chrome/browser/ui/browser_tabstrip.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/cocoa/applescript/constants_applescript.h" 20 #include "chrome/browser/ui/cocoa/applescript/constants_applescript.h"
21 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" 21 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h"
22 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" 22 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" 23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
24 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 26
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 browser_->tab_strip_model()->CloseWebContentsAt( 205 browser_->tab_strip_model()->CloseWebContentsAt(
206 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); 206 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
207 } 207 }
208 208
209 - (NSNumber*)orderedIndex { 209 - (NSNumber*)orderedIndex {
210 return [NSNumber numberWithInt:[[self nativeHandle] orderedIndex]]; 210 return [NSNumber numberWithInt:[[self nativeHandle] orderedIndex]];
211 } 211 }
212 212
213 - (void)setOrderedIndex:(NSNumber*)anIndex { 213 - (void)setOrderedIndex:(NSNumber*)anIndex {
214 int index = [anIndex intValue] - 1; 214 int index = [anIndex intValue] - 1;
215 if (index < 0 || index >= (int)BrowserList::size()) { 215 if (index < 0 || index >= static_cast<int>(chrome::GetTotalBrowserCount())) {
216 AppleScript::SetError(AppleScript::errWrongIndex); 216 AppleScript::SetError(AppleScript::errWrongIndex);
217 return; 217 return;
218 } 218 }
219 [[self nativeHandle] setOrderedIndex:index]; 219 [[self nativeHandle] setOrderedIndex:index];
220 } 220 }
221 221
222 - (NSComparisonResult)windowComparator:(WindowAppleScript*)otherWindow { 222 - (NSComparisonResult)windowComparator:(WindowAppleScript*)otherWindow {
223 int thisIndex = [[self orderedIndex] intValue]; 223 int thisIndex = [[self orderedIndex] intValue];
224 int otherIndex = [[otherWindow orderedIndex] intValue]; 224 int otherIndex = [[otherWindow orderedIndex] intValue];
225 if (thisIndex < otherIndex) 225 if (thisIndex < otherIndex)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION); 259 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION);
260 } 260 }
261 } 261 }
262 262
263 - (void)handlesExitPresentationMode:(NSScriptCommand*)command { 263 - (void)handlesExitPresentationMode:(NSScriptCommand*)command {
264 if (browser_->window()) 264 if (browser_->window())
265 browser_->window()->ExitFullscreen(); 265 browser_->window()->ExitFullscreen();
266 } 266 }
267 267
268 @end 268 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698