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

Side by Side Diff: ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm

Issue 2589583003: Upstream Chrome on iOS source code [7/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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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/ui/settings/bar_button_activity_indicator.h"
6
7 #include "base/mac/scoped_nsobject.h"
8 #include "ios/chrome/browser/ui/ui_util.h"
9
10 @implementation BarButtonActivityIndicator {
11 base::scoped_nsobject<UIActivityIndicatorView> activityIndicator_;
12 }
13
14 - (id)initWithFrame:(CGRect)frame {
15 self = [super initWithFrame:frame];
16 if (self) {
17 activityIndicator_.reset([[UIActivityIndicatorView alloc]
18 initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]);
19 [activityIndicator_ setBackgroundColor:[UIColor clearColor]];
20 [activityIndicator_ setHidesWhenStopped:YES];
21 [activityIndicator_ startAnimating];
22 [self addSubview:activityIndicator_];
23 }
24 return self;
25 }
26
27 - (void)dealloc {
28 [activityIndicator_ stopAnimating];
29 [super dealloc];
30 }
31
32 - (void)layoutSubviews {
33 [super layoutSubviews];
34 CGSize boundsSize = self.bounds.size;
35 CGPoint center = CGPointMake(boundsSize.width / 2, boundsSize.height / 2);
36 [activityIndicator_ setCenter:AlignPointToPixel(center)];
37 }
38
39 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698