Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1676)

Unified Diff: ios/chrome/browser/ui/settings/settings_utils.mm

Issue 2587023002: Upstream Chrome on iOS source code [8/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/settings/settings_utils.mm
diff --git a/ios/chrome/browser/ui/settings/settings_utils.mm b/ios/chrome/browser/ui/settings/settings_utils.mm
new file mode 100644
index 0000000000000000000000000000000000000000..9a35e8174b2f6bd3461ef7e30b3393b5f1a1ff7b
--- /dev/null
+++ b/ios/chrome/browser/ui/settings/settings_utils.mm
@@ -0,0 +1,30 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/settings/settings_utils.h"
+
+#include "base/ios/weak_nsobject.h"
+#include "base/mac/scoped_nsobject.h"
+#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
+#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
+#include "ios/chrome/browser/ui/commands/ios_command_ids.h"
+#import "ios/chrome/browser/ui/commands/open_url_command.h"
+
+namespace ios_internal_settings {
+
+ProceduralBlockWithURL BlockToOpenURL(UIResponder* responder) {
+ base::WeakNSObject<UIResponder> weakResponder(responder);
+ ProceduralBlockWithURL blockToOpenURL = ^(const GURL& url) {
+ base::scoped_nsobject<UIResponder> strongResponder([weakResponder retain]);
+ if (!strongResponder)
+ return;
+ base::scoped_nsobject<OpenUrlCommand> command(
+ [[OpenUrlCommand alloc] initWithURLFromChrome:url]);
+ [command setTag:IDC_CLOSE_SETTINGS_AND_OPEN_URL];
+ [strongResponder chromeExecuteCommand:command];
+ };
+ return [[blockToOpenURL copy] autorelease];
+}
+
+} // namespace ios_internal_settings

Powered by Google App Engine
This is Rietveld 408576698