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/generic_chrome_command.h" | 5 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
6 | 6 |
7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 10 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
11 | 11 |
12 @implementation GenericChromeCommand { | 12 @implementation GenericChromeCommand |
13 NSInteger _tag; | |
14 } | |
15 | 13 |
16 @synthesize tag = _tag; | 14 @synthesize tag = _tag; |
17 | 15 |
18 - (instancetype)init { | |
19 return [self initWithTag:0]; | |
20 } | |
21 | |
22 - (instancetype)initWithTag:(NSInteger)tag { | 16 - (instancetype)initWithTag:(NSInteger)tag { |
23 self = [super init]; | 17 self = [super init]; |
24 if (self) { | 18 if (self) { |
25 _tag = tag; | 19 _tag = tag; |
26 } | 20 } |
27 return self; | 21 return self; |
28 } | 22 } |
29 | 23 |
30 - (void)executeOnMainWindow { | 24 - (void)executeOnMainWindow { |
31 UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow]; | 25 UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow]; |
32 DCHECK(mainWindow); | 26 DCHECK(mainWindow); |
33 [mainWindow chromeExecuteCommand:self]; | 27 [mainWindow chromeExecuteCommand:self]; |
34 } | 28 } |
35 | 29 |
36 @end | 30 @end |
OLD | NEW |