1// Copyright 2013 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#ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_LOADING_SHIELD_CONTROLLER_H_
6#define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_LOADING_SHIELD_CONTROLLER_H_
7
8#import <Cocoa/Cocoa.h>
9
10#include "base/mac/scoped_nsobject.h"
11#include "base/memory/scoped_ptr.h"
12#import "chrome/browser/ui/cocoa/autofill/autofill_layout.h"
13
14class AutofillLoadingAnimationBridge;
15
16namespace autofill {
17class AutofillDialogViewDelegate;
18class LoadingAnimation;
19}
20
21// Controller for the "Loading..." shield view of the Autofill dialog.
22@interface AutofillLoadingShieldController : NSViewController<AutofillLayout> {
23 @private
24  // The main label for the shield.
25  base::scoped_nsobject<NSTextField> message_;
26
27  // The animate dots that follow the |message_|.
28  base::scoped_nsobject<NSArray> dots_;
29
30  // C++ bridge class for animating the dots.
31  scoped_ptr<AutofillLoadingAnimationBridge> animationDriver_;
32
33  autofill::AutofillDialogViewDelegate* delegate_;  // not owned, owns dialog.
34}
35
36// Designated initializer.
37- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
38
39// Updates the layout of the loading shield based on the |delegate_|'s state.
40- (void)update;
41
42// Updates the positions of the dots to match the current frame of the
43// |animation|.
44- (void)relayoutDotsForSteppedAnimation:
45    (const autofill::LoadingAnimation&)animation;
46
47@end
48
49#endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_LOADING_SHIELD_CONTROLLER_H_
50