| OLD | NEW |
| 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/tab_applescript.h" | 5 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> |
| 8 #import <Foundation/NSAppleEventDescriptor.h> |
| 9 |
| 7 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 11 #include "base/logging.h" |
| 9 #import "base/memory/scoped_nsobject.h" | 12 #import "base/memory/scoped_nsobject.h" |
| 10 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
| 11 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/printing/print_view_manager.h" | 15 #include "chrome/browser/printing/print_view_manager.h" |
| 13 #include "chrome/browser/sessions/restore_tab_helper.h" | 16 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 14 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
| 15 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" | 18 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 17 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 18 #include "content/browser/download/save_package.h" | 21 #include "content/browser/download/save_package.h" |
| 19 #include "content/browser/renderer_host/render_view_host.h" | 22 #include "content/browser/renderer_host/render_view_host.h" |
| 20 #include "content/browser/tab_contents/navigation_controller.h" | 23 #include "content/browser/tab_contents/navigation_controller.h" |
| 21 #include "content/browser/tab_contents/navigation_entry.h" | 24 #include "content/browser/tab_contents/navigation_entry.h" |
| 22 #include "content/browser/tab_contents/tab_contents_delegate.h" | 25 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 23 #include "content/common/view_messages.h" | |
| 24 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 25 | 27 |
| 26 @interface AnyResultValue : NSObject { | 28 @interface AnyResultValue : NSObject { |
| 27 @private | 29 @private |
| 28 scoped_nsobject<NSAppleEventDescriptor> descriptor; | 30 scoped_nsobject<NSAppleEventDescriptor> descriptor; |
| 29 } | 31 } |
| 30 - (id)initWithDescriptor:(NSAppleEventDescriptor*)desc; | 32 - (id)initWithDescriptor:(NSAppleEventDescriptor*)desc; |
| 31 - (NSAppleEventDescriptor *)scriptingAnyDescriptor; | 33 - (NSAppleEventDescriptor *)scriptingAnyDescriptor; |
| 32 @end | 34 @end |
| 33 | 35 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 397 } |
| 396 | 398 |
| 397 string16 script = base::SysNSStringToUTF16( | 399 string16 script = base::SysNSStringToUTF16( |
| 398 [[command evaluatedArguments] objectForKey:@"javascript"]); | 400 [[command evaluatedArguments] objectForKey:@"javascript"]); |
| 399 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script); | 401 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script); |
| 400 NSAppleEventDescriptor* descriptor = valueToDescriptor(value); | 402 NSAppleEventDescriptor* descriptor = valueToDescriptor(value); |
| 401 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease]; | 403 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease]; |
| 402 } | 404 } |
| 403 | 405 |
| 404 @end | 406 @end |
| OLD | NEW |