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

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

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 months 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 | Annotate | Revision Log
OLDNEW
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #import "base/memory/scoped_nsobject.h" 12 #import "base/memory/scoped_nsobject.h"
13 #include "base/sys_string_conversions.h" 13 #include "base/sys_string_conversions.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/printing/print_view_manager.h" 15 #include "chrome/browser/printing/print_view_manager.h"
16 #include "chrome/browser/sessions/restore_tab_helper.h" 16 #include "chrome/browser/sessions/restore_tab_helper.h"
17 #include "chrome/browser/sessions/session_id.h" 17 #include "chrome/browser/sessions/session_id.h"
18 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" 18 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "content/browser/download/save_package.h" 21 #include "content/browser/download/save_package.h"
22 #include "content/browser/renderer_host/render_view_host.h" 22 #include "content/browser/renderer_host/render_view_host.h"
23 #include "content/browser/tab_contents/tab_contents.h" 23 #include "content/browser/tab_contents/tab_contents.h"
24 #include "content/public/browser/navigation_controller.h" 24 #include "content/public/browser/navigation_controller.h"
25 #include "content/public/browser/navigation_entry.h" 25 #include "content/public/browser/navigation_entry.h"
26 #include "content/public/browser/web_contents_delegate.h" 26 #include "content/public/browser/web_contents_delegate.h"
27 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
28 28
29 using content::NavigationController;
29 using content::NavigationEntry; 30 using content::NavigationEntry;
30 using content::OpenURLParams; 31 using content::OpenURLParams;
31 using content::Referrer; 32 using content::Referrer;
32 33
33 @interface AnyResultValue : NSObject { 34 @interface AnyResultValue : NSObject {
34 @private 35 @private
35 scoped_nsobject<NSAppleEventDescriptor> descriptor; 36 scoped_nsobject<NSAppleEventDescriptor> descriptor;
36 } 37 }
37 - (id)initWithDescriptor:(NSAppleEventDescriptor*)desc; 38 - (id)initWithDescriptor:(NSAppleEventDescriptor*)desc;
38 - (NSAppleEventDescriptor *)scriptingAnyDescriptor; 39 - (NSAppleEventDescriptor *)scriptingAnyDescriptor;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 RenderViewHost* view = tabContents_->tab_contents()->GetRenderViewHost(); 302 RenderViewHost* view = tabContents_->tab_contents()->GetRenderViewHost();
302 if (!view) { 303 if (!view) {
303 NOTREACHED(); 304 NOTREACHED();
304 return; 305 return;
305 } 306 }
306 307
307 view->SelectAll(); 308 view->SelectAll();
308 } 309 }
309 310
310 - (void)handlesGoBackScriptCommand:(NSScriptCommand*)command { 311 - (void)handlesGoBackScriptCommand:(NSScriptCommand*)command {
311 content::NavigationController& navigationController = 312 NavigationController& navigationController =
312 tabContents_->tab_contents()->GetController(); 313 tabContents_->tab_contents()->GetController();
313 if (navigationController.CanGoBack()) 314 if (navigationController.CanGoBack())
314 navigationController.GoBack(); 315 navigationController.GoBack();
315 } 316 }
316 317
317 - (void)handlesGoForwardScriptCommand:(NSScriptCommand*)command { 318 - (void)handlesGoForwardScriptCommand:(NSScriptCommand*)command {
318 content::NavigationController& navigationController = 319 NavigationController& navigationController =
319 tabContents_->tab_contents()->GetController(); 320 tabContents_->tab_contents()->GetController();
320 if (navigationController.CanGoForward()) 321 if (navigationController.CanGoForward())
321 navigationController.GoForward(); 322 navigationController.GoForward();
322 } 323 }
323 324
324 - (void)handlesReloadScriptCommand:(NSScriptCommand*)command { 325 - (void)handlesReloadScriptCommand:(NSScriptCommand*)command {
325 content::NavigationController& navigationController = 326 NavigationController& navigationController =
326 tabContents_->tab_contents()->GetController(); 327 tabContents_->tab_contents()->GetController();
327 const bool checkForRepost = true; 328 const bool checkForRepost = true;
328 navigationController.Reload(checkForRepost); 329 navigationController.Reload(checkForRepost);
329 } 330 }
330 331
331 - (void)handlesStopScriptCommand:(NSScriptCommand*)command { 332 - (void)handlesStopScriptCommand:(NSScriptCommand*)command {
332 RenderViewHost* view = tabContents_->tab_contents()->GetRenderViewHost(); 333 RenderViewHost* view = tabContents_->tab_contents()->GetRenderViewHost();
333 if (!view) { 334 if (!view) {
334 // We tolerate Stop being called even before a view has been created. 335 // We tolerate Stop being called even before a view has been created.
335 // So just log a warning instead of a NOTREACHED(). 336 // So just log a warning instead of a NOTREACHED().
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 413 }
413 414
414 string16 script = base::SysNSStringToUTF16( 415 string16 script = base::SysNSStringToUTF16(
415 [[command evaluatedArguments] objectForKey:@"javascript"]); 416 [[command evaluatedArguments] objectForKey:@"javascript"]);
416 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script); 417 Value* value = view->ExecuteJavascriptAndGetValue(string16(), script);
417 NSAppleEventDescriptor* descriptor = valueToDescriptor(value); 418 NSAppleEventDescriptor* descriptor = valueToDescriptor(value);
418 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease]; 419 return [[[AnyResultValue alloc] initWithDescriptor:descriptor] autorelease];
419 } 420 }
420 421
421 @end 422 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698