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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 navigationController.GoForward(); | 201 navigationController.GoForward(); |
202 } | 202 } |
203 | 203 |
204 - (void)handlesReloadScriptCommand:(NSScriptCommand*)command { | 204 - (void)handlesReloadScriptCommand:(NSScriptCommand*)command { |
205 NavigationController& navigationController = webContents_->GetController(); | 205 NavigationController& navigationController = webContents_->GetController(); |
206 const bool checkForRepost = true; | 206 const bool checkForRepost = true; |
207 navigationController.Reload(checkForRepost); | 207 navigationController.Reload(checkForRepost); |
208 } | 208 } |
209 | 209 |
210 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { | 210 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { |
211 RenderViewHost* view = webContents_->GetRenderViewHost(); | 211 webContents_->Stop(); |
212 if (!view) { | |
213 // We tolerate Stop being called even before a view has been created. | |
214 // So just log a warning instead of a NOTREACHED(). | |
215 DLOG(WARNING) << "Stop: no view for handle "; | |
216 return; | |
217 } | |
218 | |
219 view->Stop(); | |
220 } | 212 } |
221 | 213 |
222 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { | 214 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { |
223 bool initiated = | 215 bool initiated = |
224 printing::PrintViewManager::FromWebContents(webContents_)->PrintNow(); | 216 printing::PrintViewManager::FromWebContents(webContents_)->PrintNow(); |
225 if (!initiated) { | 217 if (!initiated) { |
226 AppleScript::SetError(AppleScript::errInitiatePrinting); | 218 AppleScript::SetError(AppleScript::errInitiatePrinting); |
227 } | 219 } |
228 } | 220 } |
229 | 221 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 base::Bind(&ResumeAppleEventAndSendReply, suspensionID); | 286 base::Bind(&ResumeAppleEventAndSendReply, suspensionID); |
295 | 287 |
296 base::string16 script = base::SysNSStringToUTF16( | 288 base::string16 script = base::SysNSStringToUTF16( |
297 [[command evaluatedArguments] objectForKey:@"javascript"]); | 289 [[command evaluatedArguments] objectForKey:@"javascript"]); |
298 frame->ExecuteJavaScript(script, callback); | 290 frame->ExecuteJavaScript(script, callback); |
299 | 291 |
300 return nil; | 292 return nil; |
301 } | 293 } |
302 | 294 |
303 @end | 295 @end |
OLD | NEW |