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

Unified Diff: ios/chrome/share_extension/ui_util.mm

Issue 2586713002: Upstream code and resources for Chrome on iOS extensions. (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
« no previous file with comments | « ios/chrome/share_extension/ui_util.h ('k') | ios/chrome/today_extension/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/share_extension/ui_util.mm
diff --git a/ios/chrome/share_extension/ui_util.mm b/ios/chrome/share_extension/ui_util.mm
new file mode 100644
index 0000000000000000000000000000000000000000..c898d5141add272a634caeb39ba102284ebfd834
--- /dev/null
+++ b/ios/chrome/share_extension/ui_util.mm
@@ -0,0 +1,29 @@
+// Copyright 2016 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 <UIKit/UIKit.h>
+
+#include "ios/chrome/share_extension/ui_util.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace ui_util {
+
+CGFloat AlignValueToPixel(CGFloat value) {
+ CGFloat scale = [[UIScreen mainScreen] scale];
+ return floor(value * scale) / scale;
+}
+
+void ConstrainAllSidesOfViewToView(UIView* container, UIView* filler) {
+ [NSLayoutConstraint activateConstraints:@[
+ [filler.leadingAnchor constraintEqualToAnchor:container.leadingAnchor],
+ [filler.trailingAnchor constraintEqualToAnchor:container.trailingAnchor],
+ [filler.topAnchor constraintEqualToAnchor:container.topAnchor],
+ [filler.bottomAnchor constraintEqualToAnchor:container.bottomAnchor],
+ ]];
+}
+
+} // namespace ui_util
« no previous file with comments | « ios/chrome/share_extension/ui_util.h ('k') | ios/chrome/today_extension/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698