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/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 | 298 |
299 - (void)handlesCloseScriptCommand:(NSScriptCommand*)command { | 299 - (void)handlesCloseScriptCommand:(NSScriptCommand*)command { |
300 webContents_->GetDelegate()->CloseContents(webContents_); | 300 webContents_->GetDelegate()->CloseContents(webContents_); |
301 } | 301 } |
302 | 302 |
303 - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command { | 303 - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command { |
304 NavigationEntry* entry = | 304 NavigationEntry* entry = |
305 webContents_->GetController().GetLastCommittedEntry(); | 305 webContents_->GetController().GetLastCommittedEntry(); |
306 if (entry) { | 306 if (entry) { |
307 webContents_->OpenURL(OpenURLParams( | 307 webContents_->OpenURL( |
308 GURL(chrome::kViewSourceScheme + std::string(":") + | 308 OpenURLParams(GURL(content::kViewSourceScheme + std::string(":") + |
309 entry->GetURL().spec()), | 309 entry->GetURL().spec()), |
310 Referrer(), | 310 Referrer(), |
311 NEW_FOREGROUND_TAB, | 311 NEW_FOREGROUND_TAB, |
312 content::PAGE_TRANSITION_LINK, | 312 content::PAGE_TRANSITION_LINK, |
313 false)); | 313 false)); |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 - (id)handlesExecuteJavascriptScriptCommand:(NSScriptCommand*)command { | 317 - (id)handlesExecuteJavascriptScriptCommand:(NSScriptCommand*)command { |
318 RenderViewHost* view = webContents_->GetRenderViewHost(); | 318 RenderViewHost* view = webContents_->GetRenderViewHost(); |
319 if (!view) { | 319 if (!view) { |
320 NOTREACHED(); | 320 NOTREACHED(); |
321 return nil; | 321 return nil; |
322 } | 322 } |
323 | 323 |
324 NSAppleEventManager* manager = [NSAppleEventManager sharedAppleEventManager]; | 324 NSAppleEventManager* manager = [NSAppleEventManager sharedAppleEventManager]; |
325 NSAppleEventManagerSuspensionID suspensionID = | 325 NSAppleEventManagerSuspensionID suspensionID = |
326 [manager suspendCurrentAppleEvent]; | 326 [manager suspendCurrentAppleEvent]; |
327 content::RenderViewHost::JavascriptResultCallback callback = | 327 content::RenderViewHost::JavascriptResultCallback callback = |
328 base::Bind(&ResumeAppleEventAndSendReply, suspensionID); | 328 base::Bind(&ResumeAppleEventAndSendReply, suspensionID); |
329 | 329 |
330 string16 script = base::SysNSStringToUTF16( | 330 string16 script = base::SysNSStringToUTF16( |
331 [[command evaluatedArguments] objectForKey:@"javascript"]); | 331 [[command evaluatedArguments] objectForKey:@"javascript"]); |
332 view->ExecuteJavascriptInWebFrameCallbackResult(string16(), // frame_xpath | 332 view->ExecuteJavascriptInWebFrameCallbackResult(string16(), // frame_xpath |
333 script, | 333 script, |
334 callback); | 334 callback); |
335 | 335 |
336 return nil; | 336 return nil; |
337 } | 337 } |
338 | 338 |
339 @end | 339 @end |
OLD | NEW |