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

Unified 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698