OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/settings/settings_utils.h" | 5 #import "ios/chrome/browser/ui/settings/settings_utils.h" |
6 | 6 |
7 #import "base/ios/weak_nsobject.h" | |
8 #import "base/mac/scoped_nsobject.h" | |
9 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 7 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
10 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 8 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
11 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
12 #import "ios/chrome/browser/ui/commands/open_url_command.h" | 10 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
13 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
14 namespace ios_internal_settings { | 16 namespace ios_internal_settings { |
15 | 17 |
16 ProceduralBlockWithURL BlockToOpenURL(UIResponder* responder) { | 18 ProceduralBlockWithURL BlockToOpenURL(UIResponder* responder) { |
17 base::WeakNSObject<UIResponder> weakResponder(responder); | 19 __weak UIResponder* weakResponder = responder; |
18 ProceduralBlockWithURL blockToOpenURL = ^(const GURL& url) { | 20 ProceduralBlockWithURL blockToOpenURL = ^(const GURL& url) { |
19 base::scoped_nsobject<UIResponder> strongResponder([weakResponder retain]); | 21 UIResponder* strongResponder = weakResponder; |
20 if (!strongResponder) | 22 if (!strongResponder) |
21 return; | 23 return; |
22 base::scoped_nsobject<OpenUrlCommand> command( | 24 OpenUrlCommand* command = |
23 [[OpenUrlCommand alloc] initWithURLFromChrome:url]); | 25 [[OpenUrlCommand alloc] initWithURLFromChrome:url]; |
24 [command setTag:IDC_CLOSE_SETTINGS_AND_OPEN_URL]; | 26 [command setTag:IDC_CLOSE_SETTINGS_AND_OPEN_URL]; |
25 [strongResponder chromeExecuteCommand:command]; | 27 [strongResponder chromeExecuteCommand:command]; |
26 }; | 28 }; |
27 return [[blockToOpenURL copy] autorelease]; | 29 return [blockToOpenURL copy]; |
28 } | 30 } |
29 | 31 |
30 } // namespace ios_internal_settings | 32 } // namespace ios_internal_settings |
OLD | NEW |