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

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

Issue 8585010: Properly destroy tabs via AppleScript. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 params.disposition = NEW_FOREGROUND_TAB; 194 params.disposition = NEW_FOREGROUND_TAB;
195 params.tabstrip_index = index; 195 params.tabstrip_index = index;
196 browser::Navigate(&params); 196 browser::Navigate(&params);
197 params.target_contents->tab_contents()->set_new_tab_start_time( 197 params.target_contents->tab_contents()->set_new_tab_start_time(
198 newTabStartTime); 198 newTabStartTime);
199 199
200 [aTab setTabContent:params.target_contents]; 200 [aTab setTabContent:params.target_contents];
201 } 201 }
202 202
203 - (void)removeFromTabsAtIndex:(int)index { 203 - (void)removeFromTabsAtIndex:(int)index {
204 browser_->tabstrip_model()->DetachTabContentsAt(index); 204 browser_->CloseTabContents(browser_->GetTabContentsAt(index));
205 } 205 }
206 206
207 - (NSNumber*)orderedIndex{ 207 - (NSNumber*)orderedIndex {
208 return [NSNumber numberWithInt:[[self nativeHandle] orderedIndex]]; 208 return [NSNumber numberWithInt:[[self nativeHandle] orderedIndex]];
209 } 209 }
210 210
211 - (void)setOrderedIndex:(NSNumber*)anIndex { 211 - (void)setOrderedIndex:(NSNumber*)anIndex {
212 int index = [anIndex intValue] - 1; 212 int index = [anIndex intValue] - 1;
213 if (index < 0 || index >= (int)BrowserList::size()) { 213 if (index < 0 || index >= (int)BrowserList::size()) {
214 AppleScript::SetError(AppleScript::errWrongIndex); 214 AppleScript::SetError(AppleScript::errWrongIndex);
215 return; 215 return;
216 } 216 }
217 [[self nativeHandle] setOrderedIndex:index]; 217 [[self nativeHandle] setOrderedIndex:index];
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION); 257 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION);
258 } 258 }
259 } 259 }
260 260
261 - (void)handlesExitPresentationMode:(NSScriptCommand*)command { 261 - (void)handlesExitPresentationMode:(NSScriptCommand*)command {
262 if (browser_->window()) 262 if (browser_->window())
263 browser_->window()->ExitPresentationMode(); 263 browser_->window()->ExitPresentationMode();
264 } 264 }
265 265
266 @end 266 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698