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

Unified Diff: ios/chrome/browser/passwords/password_generation_utils.mm

Issue 1022463002: [iOS] Upstream files in //ios/chrome/browser/autofill (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 months 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/browser/passwords/password_generation_utils.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/passwords/password_generation_utils.mm
diff --git a/ios/chrome/browser/passwords/password_generation_utils.mm b/ios/chrome/browser/passwords/password_generation_utils.mm
new file mode 100644
index 0000000000000000000000000000000000000000..7f1abd44dba9920598c3052e76e67307dae93191
--- /dev/null
+++ b/ios/chrome/browser/passwords/password_generation_utils.mm
@@ -0,0 +1,50 @@
+// Copyright 2014 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.
+
+#include "ios/chrome/browser/passwords/password_generation_utils.h"
+
+#include "base/i18n/rtl.h"
+#include "ios/chrome/browser/ui/ui_util.h"
+
+namespace passwords {
+
+namespace {
+
+const CGFloat kPadding = IsIPadIdiom() ? 16 : 8;
+
+// The actual implementation of |RunPipeline| that begins with the first block
+// in |blocks|.
+void RunSearchPipeline(NSArray* blocks,
+ PipelineCompletionBlock on_complete,
+ NSUInteger from_index) {
+ if (from_index == [blocks count]) {
+ on_complete(NSNotFound);
+ return;
+ }
+ PipelineBlock block = blocks[from_index];
+ block(^(BOOL success) {
+ if (success)
+ on_complete(from_index);
+ else
+ RunSearchPipeline(blocks, on_complete, from_index + 1);
+ });
+}
+
+} // namespace
+
+CGRect GetGenerationAccessoryFrame(CGRect outer_frame, CGRect inner_frame) {
+ CGFloat x = kPadding;
+ if (base::i18n::IsRTL())
+ x = CGRectGetWidth(outer_frame) - CGRectGetWidth(inner_frame) - kPadding;
+ const CGFloat y =
+ (CGRectGetHeight(outer_frame) - CGRectGetHeight(inner_frame)) / 2.0;
+ inner_frame.origin = CGPointMake(x, y);
+ return inner_frame;
+}
+
+void RunSearchPipeline(NSArray* blocks, PipelineCompletionBlock on_complete) {
+ RunSearchPipeline(blocks, on_complete, 0);
+}
+
+} // namespace passwords
« no previous file with comments | « ios/chrome/browser/passwords/password_generation_utils.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698