| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/ui/commands/open_url_command.h" | 5 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 8 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 9 #include "ios/web/public/referrer.h" | 9 #include "ios/web/public/referrer.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) | 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." | 13 #error "This file requires ARC support." |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 @implementation OpenUrlCommand { | 16 @implementation OpenUrlCommand { |
| 17 GURL _url; | 17 GURL _url; |
| 18 web::Referrer _referrer; | 18 web::Referrer _referrer; |
| 19 } | 19 } |
| 20 | 20 |
| 21 @synthesize inIncognito = _inIncognito; | 21 @synthesize inIncognito = _inIncognito; |
| 22 @synthesize inBackground = _inBackground; | 22 @synthesize inBackground = _inBackground; |
| 23 @synthesize fromChrome = _fromChrome; | 23 @synthesize fromChrome = _fromChrome; |
| 24 @synthesize appendTo = _appendTo; | 24 @synthesize appendTo = _appendTo; |
| 25 @synthesize windowName = _windowName; | |
| 26 | 25 |
| 27 - (instancetype)initWithTag:(NSInteger)tag { | 26 - (instancetype)initWithTag:(NSInteger)tag { |
| 28 NOTREACHED(); | 27 NOTREACHED(); |
| 29 return nil; | 28 return nil; |
| 30 } | 29 } |
| 31 | 30 |
| 32 - (instancetype)initWithURL:(const GURL&)url | 31 - (instancetype)initWithURL:(const GURL&)url |
| 33 referrer:(const web::Referrer&)referrer | 32 referrer:(const web::Referrer&)referrer |
| 34 windowName:(NSString*)windowName | |
| 35 inIncognito:(BOOL)inIncognito | 33 inIncognito:(BOOL)inIncognito |
| 36 inBackground:(BOOL)inBackground | 34 inBackground:(BOOL)inBackground |
| 37 appendTo:(OpenPosition)appendTo { | 35 appendTo:(OpenPosition)appendTo { |
| 38 if ((self = [super initWithTag:IDC_OPEN_URL])) { | 36 if ((self = [super initWithTag:IDC_OPEN_URL])) { |
| 39 _url = url; | 37 _url = url; |
| 40 _referrer = referrer; | 38 _referrer = referrer; |
| 41 _windowName = [windowName copy]; | |
| 42 _inIncognito = inIncognito; | 39 _inIncognito = inIncognito; |
| 43 _inBackground = inBackground; | 40 _inBackground = inBackground; |
| 44 _appendTo = appendTo; | 41 _appendTo = appendTo; |
| 45 } | 42 } |
| 46 return self; | 43 return self; |
| 47 } | 44 } |
| 48 | 45 |
| 49 - (instancetype)initWithURLFromChrome:(const GURL&)url { | 46 - (instancetype)initWithURLFromChrome:(const GURL&)url { |
| 50 if ((self = [self initWithURL:url | 47 if ((self = [self initWithURL:url |
| 51 referrer:web::Referrer() | 48 referrer:web::Referrer() |
| 52 windowName:nil | |
| 53 inIncognito:NO | 49 inIncognito:NO |
| 54 inBackground:NO | 50 inBackground:NO |
| 55 appendTo:kLastTab])) { | 51 appendTo:kLastTab])) { |
| 56 _fromChrome = YES; | 52 _fromChrome = YES; |
| 57 } | 53 } |
| 58 return self; | 54 return self; |
| 59 } | 55 } |
| 60 | 56 |
| 61 - (const GURL&)url { | 57 - (const GURL&)url { |
| 62 return _url; | 58 return _url; |
| 63 } | 59 } |
| 64 | 60 |
| 65 - (const web::Referrer&)referrer { | 61 - (const web::Referrer&)referrer { |
| 66 return _referrer; | 62 return _referrer; |
| 67 } | 63 } |
| 68 | 64 |
| 69 @end | 65 @end |
| OLD | NEW |