| 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/tab_applescript.h" | 5 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 navigationController.Reload(checkForRepost); | 217 navigationController.Reload(checkForRepost); |
| 218 } | 218 } |
| 219 | 219 |
| 220 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { | 220 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { |
| 221 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_STOP); | 221 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_STOP); |
| 222 webContents_->Stop(); | 222 webContents_->Stop(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { | 225 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { |
| 226 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); | 226 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); |
| 227 bool initiated = | 227 bool initiated = printing::PrintViewManager::FromWebContents(webContents_) |
| 228 printing::PrintViewManager::FromWebContents(webContents_)->PrintNow(); | 228 ->PrintNow(webContents_->GetMainFrame()); |
| 229 if (!initiated) { | 229 if (!initiated) { |
| 230 AppleScript::SetError(AppleScript::errInitiatePrinting); | 230 AppleScript::SetError(AppleScript::errInitiatePrinting); |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 | 233 |
| 234 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { | 234 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { |
| 235 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_SAVE); | 235 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_SAVE); |
| 236 NSDictionary* dictionary = [command evaluatedArguments]; | 236 NSDictionary* dictionary = [command evaluatedArguments]; |
| 237 | 237 |
| 238 NSURL* fileURL = [dictionary objectForKey:@"File"]; | 238 NSURL* fileURL = [dictionary objectForKey:@"File"]; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 base::string16 script = base::SysNSStringToUTF16( | 304 base::string16 script = base::SysNSStringToUTF16( |
| 305 [[command evaluatedArguments] objectForKey:@"javascript"]); | 305 [[command evaluatedArguments] objectForKey:@"javascript"]); |
| 306 frame->ExecuteJavaScriptInIsolatedWorld( | 306 frame->ExecuteJavaScriptInIsolatedWorld( |
| 307 script, callback, chrome::ISOLATED_WORLD_ID_APPLESCRIPT); | 307 script, callback, chrome::ISOLATED_WORLD_ID_APPLESCRIPT); |
| 308 | 308 |
| 309 return nil; | 309 return nil; |
| 310 } | 310 } |
| 311 | 311 |
| 312 @end | 312 @end |
| OLD | NEW |