| 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 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <Foundation/NSAppleEventDescriptor.h> | 8 #import <Foundation/NSAppleEventDescriptor.h> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // We tolerate Stop being called even before a view has been created. | 335 // We tolerate Stop being called even before a view has been created. |
| 336 // So just log a warning instead of a NOTREACHED(). | 336 // So just log a warning instead of a NOTREACHED(). |
| 337 DLOG(WARNING) << "Stop: no view for handle "; | 337 DLOG(WARNING) << "Stop: no view for handle "; |
| 338 return; | 338 return; |
| 339 } | 339 } |
| 340 | 340 |
| 341 view->Stop(); | 341 view->Stop(); |
| 342 } | 342 } |
| 343 | 343 |
| 344 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { | 344 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { |
| 345 bool initiateStatus = tabContents_->print_view_manager()->PrintNow(); | 345 bool initiateStatus = printing::PrintViewManager::FromWebContents( |
| 346 tabContents_->web_contents())->PrintNow(); |
| 346 if (initiateStatus == false) { | 347 if (initiateStatus == false) { |
| 347 AppleScript::SetError(AppleScript::errInitiatePrinting); | 348 AppleScript::SetError(AppleScript::errInitiatePrinting); |
| 348 } | 349 } |
| 349 } | 350 } |
| 350 | 351 |
| 351 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { | 352 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { |
| 352 NSDictionary* dictionary = [command evaluatedArguments]; | 353 NSDictionary* dictionary = [command evaluatedArguments]; |
| 353 | 354 |
| 354 NSURL* fileURL = [dictionary objectForKey:@"File"]; | 355 NSURL* fileURL = [dictionary objectForKey:@"File"]; |
| 355 // Scripter has not specifed the location at which to save, so we prompt for | 356 // Scripter has not specifed the location at which to save, so we prompt for |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 411 } |
| 411 | 412 |
| 412 string16 script = base::SysNSStringToUTF16( | 413 string16 script = base::SysNSStringToUTF16( |
| 413 [[command evaluatedArguments] objectForKey:@"javascript"]); | 414 [[command evaluatedArguments] objectForKey:@"javascript"]); |
| 414 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script); | 415 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script); |
| 415 NSAppleEventDescriptor* descriptor = valueToDescriptor(value); | 416 NSAppleEventDescriptor* descriptor = valueToDescriptor(value); |
| 416 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease]; | 417 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease]; |
| 417 } | 418 } |
| 418 | 419 |
| 419 @end | 420 @end |
| OLD | NEW |