OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
| 6 |
| 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "ios/web/public/referrer.h" |
| 9 #include "url/gurl.h" |
| 10 |
| 11 @implementation OpenUrlCommand { |
| 12 GURL _url; |
| 13 web::Referrer _referrer; |
| 14 base::scoped_nsobject<NSString> _windowName; |
| 15 BOOL _inIncognito; |
| 16 BOOL _inBackground; |
| 17 BOOL _fromChrome; |
| 18 OpenPosition _appendTo; |
| 19 } |
| 20 |
| 21 @synthesize fromChrome = _fromChrome; |
| 22 |
| 23 - (id)initWithURL:(const GURL&)url |
| 24 referrer:(const web::Referrer&)referrer |
| 25 windowName:(NSString*)windowName |
| 26 inIncognito:(BOOL)inIncognito |
| 27 inBackground:(BOOL)inBackground |
| 28 appendTo:(OpenPosition)appendTo { |
| 29 if ((self = [super init])) { |
| 30 _url = url; |
| 31 _referrer = referrer; |
| 32 _windowName.reset([windowName retain]); |
| 33 _inIncognito = inIncognito; |
| 34 _inBackground = inBackground; |
| 35 _appendTo = appendTo; |
| 36 } |
| 37 return self; |
| 38 } |
| 39 |
| 40 - (id)initWithURLFromChrome:(const GURL&)url { |
| 41 if ((self = [self initWithURL:url |
| 42 referrer:web::Referrer() |
| 43 windowName:nil |
| 44 inIncognito:NO |
| 45 inBackground:NO |
| 46 appendTo:kLastTab])) { |
| 47 _fromChrome = YES; |
| 48 } |
| 49 return self; |
| 50 } |
| 51 |
| 52 - (const GURL&)url { |
| 53 return _url; |
| 54 } |
| 55 |
| 56 - (const web::Referrer&)referrer { |
| 57 return _referrer; |
| 58 } |
| 59 |
| 60 - (NSString*)windowName { |
| 61 return _windowName.get(); |
| 62 } |
| 63 |
| 64 - (BOOL)inIncognito { |
| 65 return _inIncognito; |
| 66 } |
| 67 |
| 68 - (BOOL)inBackground { |
| 69 return _inBackground; |
| 70 } |
| 71 |
| 72 - (OpenPosition)appendTo { |
| 73 return _appendTo; |
| 74 } |
| 75 |
| 76 @end |
OLD | NEW |