Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chrome/browser/ui/cocoa/applescript/tab_applescript.mm

Issue 2508923003: Make printing work better with OOPIF. (try 2) (Closed)
Patch Set: Fix android_webview Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 navigationController.Reload(checkForRepost); 224 navigationController.Reload(checkForRepost);
225 } 225 }
226 226
227 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { 227 - (void)handlesStopScriptCommand:(NSScriptCommand*)command {
228 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_STOP); 228 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_STOP);
229 webContents_->Stop(); 229 webContents_->Stop();
230 } 230 }
231 231
232 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { 232 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command {
233 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); 233 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT);
234 bool initiated = 234 bool initiated = printing::PrintViewManager::FromWebContents(webContents_)
235 printing::PrintViewManager::FromWebContents(webContents_)->PrintNow(); 235 ->PrintNow(webContents_->GetMainFrame());
236 if (!initiated) { 236 if (!initiated) {
237 AppleScript::SetError(AppleScript::errInitiatePrinting); 237 AppleScript::SetError(AppleScript::errInitiatePrinting);
238 } 238 }
239 } 239 }
240 240
241 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { 241 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command {
242 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_SAVE); 242 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_SAVE);
243 NSDictionary* dictionary = [command evaluatedArguments]; 243 NSDictionary* dictionary = [command evaluatedArguments];
244 244
245 NSURL* fileURL = [dictionary objectForKey:@"File"]; 245 NSURL* fileURL = [dictionary objectForKey:@"File"];
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 base::string16 script = base::SysNSStringToUTF16( 316 base::string16 script = base::SysNSStringToUTF16(
317 [[command evaluatedArguments] objectForKey:@"javascript"]); 317 [[command evaluatedArguments] objectForKey:@"javascript"]);
318 frame->ExecuteJavaScriptInIsolatedWorld( 318 frame->ExecuteJavaScriptInIsolatedWorld(
319 script, callback, chrome::ISOLATED_WORLD_ID_APPLESCRIPT); 319 script, callback, chrome::ISOLATED_WORLD_ID_APPLESCRIPT);
320 320
321 return nil; 321 return nil;
322 } 322 }
323 323
324 @end 324 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_commands.cc ('k') | chrome/browser/ui/webui/print_preview/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698