OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/settings/settings_utils.h" |
| 6 |
| 7 #include "base/ios/weak_nsobject.h" |
| 8 #include "base/mac/scoped_nsobject.h" |
| 9 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 10 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 11 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 12 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
| 13 |
| 14 namespace ios_internal_settings { |
| 15 |
| 16 ProceduralBlockWithURL BlockToOpenURL(UIResponder* responder) { |
| 17 base::WeakNSObject<UIResponder> weakResponder(responder); |
| 18 ProceduralBlockWithURL blockToOpenURL = ^(const GURL& url) { |
| 19 base::scoped_nsobject<UIResponder> strongResponder([weakResponder retain]); |
| 20 if (!strongResponder) |
| 21 return; |
| 22 base::scoped_nsobject<OpenUrlCommand> command( |
| 23 [[OpenUrlCommand alloc] initWithURLFromChrome:url]); |
| 24 [command setTag:IDC_CLOSE_SETTINGS_AND_OPEN_URL]; |
| 25 [strongResponder chromeExecuteCommand:command]; |
| 26 }; |
| 27 return [[blockToOpenURL copy] autorelease]; |
| 28 } |
| 29 |
| 30 } // namespace ios_internal_settings |
OLD | NEW |