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