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> | 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (!url.is_empty() && !url.is_valid()) { | 206 if (!url.is_empty() && !url.is_valid()) { |
207 AppleScript::SetError(AppleScript::errInvalidURL); | 207 AppleScript::SetError(AppleScript::errInvalidURL); |
208 return; | 208 return; |
209 } | 209 } |
210 | 210 |
211 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); | 211 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); |
212 if (!entry) | 212 if (!entry) |
213 return; | 213 return; |
214 | 214 |
215 const GURL& previousURL = entry->virtual_url(); | 215 const GURL& previousURL = entry->virtual_url(); |
216 tabContents_->tab_contents()->OpenURL(url, | 216 tabContents_->tab_contents()->OpenURL(OpenURLParams( |
217 previousURL, | 217 url, |
218 CURRENT_TAB, | 218 previousURL, |
219 content::PAGE_TRANSITION_TYPED); | 219 CURRENT_TAB, |
| 220 content::PAGE_TRANSITION_TYPED, |
| 221 false)); |
220 } | 222 } |
221 | 223 |
222 - (NSString*)title { | 224 - (NSString*)title { |
223 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); | 225 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); |
224 if (!entry) | 226 if (!entry) |
225 return nil; | 227 return nil; |
226 | 228 |
227 std::wstring title; | 229 std::wstring title; |
228 if (entry != NULL) { | 230 if (entry != NULL) { |
229 title = UTF16ToWideHack(entry->title()); | 231 title = UTF16ToWideHack(entry->title()); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 399 } |
398 | 400 |
399 string16 script = base::SysNSStringToUTF16( | 401 string16 script = base::SysNSStringToUTF16( |
400 [[command evaluatedArguments] objectForKey:@"javascript"]); | 402 [[command evaluatedArguments] objectForKey:@"javascript"]); |
401 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script); | 403 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script); |
402 NSAppleEventDescriptor* descriptor = valueToDescriptor(value); | 404 NSAppleEventDescriptor* descriptor = valueToDescriptor(value); |
403 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease]; | 405 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease]; |
404 } | 406 } |
405 | 407 |
406 @end | 408 @end |
OLD | NEW |