| Index: ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm
|
| diff --git a/ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm b/ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f37bd9a662b660b894761437c9b11d2fd1789e61
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2015 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/ui/settings/bar_button_activity_indicator.h"
|
| +
|
| +#include "base/mac/scoped_nsobject.h"
|
| +#include "ios/chrome/browser/ui/ui_util.h"
|
| +
|
| +@implementation BarButtonActivityIndicator {
|
| + base::scoped_nsobject<UIActivityIndicatorView> activityIndicator_;
|
| +}
|
| +
|
| +- (id)initWithFrame:(CGRect)frame {
|
| + self = [super initWithFrame:frame];
|
| + if (self) {
|
| + activityIndicator_.reset([[UIActivityIndicatorView alloc]
|
| + initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]);
|
| + [activityIndicator_ setBackgroundColor:[UIColor clearColor]];
|
| + [activityIndicator_ setHidesWhenStopped:YES];
|
| + [activityIndicator_ startAnimating];
|
| + [self addSubview:activityIndicator_];
|
| + }
|
| + return self;
|
| +}
|
| +
|
| +- (void)dealloc {
|
| + [activityIndicator_ stopAnimating];
|
| + [super dealloc];
|
| +}
|
| +
|
| +- (void)layoutSubviews {
|
| + [super layoutSubviews];
|
| + CGSize boundsSize = self.bounds.size;
|
| + CGPoint center = CGPointMake(boundsSize.width / 2, boundsSize.height / 2);
|
| + [activityIndicator_ setCenter:AlignPointToPixel(center)];
|
| +}
|
| +
|
| +@end
|
|
|