| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 navigationController.Reload(checkForRepost); | 224 navigationController.Reload(checkForRepost); |
| 225 } | 225 } |
| 226 | 226 |
| 227 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { | 227 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { |
| 228 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_STOP); | 228 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_STOP); |
| 229 webContents_->Stop(); | 229 webContents_->Stop(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { | 232 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { |
| 233 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); | 233 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); |
| 234 bool initiated = printing::PrintViewManager::FromWebContents(webContents_) | 234 bool initiated = |
| 235 ->PrintNow(webContents_->GetMainFrame()); | 235 printing::PrintViewManager::FromWebContents(webContents_)->PrintNow(); |
| 236 if (!initiated) { | 236 if (!initiated) { |
| 237 AppleScript::SetError(AppleScript::errInitiatePrinting); | 237 AppleScript::SetError(AppleScript::errInitiatePrinting); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { | 241 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { |
| 242 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_SAVE); | 242 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_SAVE); |
| 243 NSDictionary* dictionary = [command evaluatedArguments]; | 243 NSDictionary* dictionary = [command evaluatedArguments]; |
| 244 | 244 |
| 245 NSURL* fileURL = [dictionary objectForKey:@"File"]; | 245 NSURL* fileURL = [dictionary objectForKey:@"File"]; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 315 |
| 316 base::string16 script = base::SysNSStringToUTF16( | 316 base::string16 script = base::SysNSStringToUTF16( |
| 317 [[command evaluatedArguments] objectForKey:@"javascript"]); | 317 [[command evaluatedArguments] objectForKey:@"javascript"]); |
| 318 frame->ExecuteJavaScriptInIsolatedWorld( | 318 frame->ExecuteJavaScriptInIsolatedWorld( |
| 319 script, callback, chrome::ISOLATED_WORLD_ID_APPLESCRIPT); | 319 script, callback, chrome::ISOLATED_WORLD_ID_APPLESCRIPT); |
| 320 | 320 |
| 321 return nil; | 321 return nil; |
| 322 } | 322 } |
| 323 | 323 |
| 324 @end | 324 @end |
| OLD | NEW |