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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 #include "ios/chrome/browser/passwords/password_generation_utils.h"
6
7 #include "base/i18n/rtl.h"
8 #include "ios/chrome/browser/ui/ui_util.h"
9
10 namespace passwords {
11
12 namespace {
13
14 const CGFloat kPadding = IsIPadIdiom() ? 16 : 8;
15
16 // The actual implementation of |RunPipeline| that begins with the first block
17 // in |blocks|.
18 void RunSearchPipeline(NSArray* blocks,
19 PipelineCompletionBlock on_complete,
20 NSUInteger from_index) {
21 if (from_index == [blocks count]) {
22 on_complete(NSNotFound);
23 return;
24 }
25 PipelineBlock block = blocks[from_index];
26 block(^(BOOL success) {
27 if (success)
28 on_complete(from_index);
29 else
30 RunSearchPipeline(blocks, on_complete, from_index + 1);
31 });
32 }
33
34 } // namespace
35
36 CGRect GetGenerationAccessoryFrame(CGRect outer_frame, CGRect inner_frame) {
37 CGFloat x = kPadding;
38 if (base::i18n::IsRTL())
39 x = CGRectGetWidth(outer_frame) - CGRectGetWidth(inner_frame) - kPadding;
40 const CGFloat y =
41 (CGRectGetHeight(outer_frame) - CGRectGetHeight(inner_frame)) / 2.0;
42 inner_frame.origin = CGPointMake(x, y);
43 return inner_frame;
44 }
45
46 void RunSearchPipeline(NSArray* blocks, PipelineCompletionBlock on_complete) {
47 RunSearchPipeline(blocks, on_complete, 0);
48 }
49
50 } // namespace passwords
OLDNEW
« 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