- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / browser / password_generation_bubble_controller.h
1 // Copyright (c) 2012 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_BROWSER_PASSWORD_GENERATION_BUBBLE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_PASSWORD_GENERATION_BUBBLE_CONTROLLER_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
11 #import "chrome/browser/ui/cocoa/styled_text_field.h"
12 #include "components/autofill/core/common/password_form.h"
13 #include "components/autofill/core/common/password_generation_util.h"
14
15 namespace autofill {
16 class PasswordGenerator;
17 }
18
19 namespace content {
20 class RenderViewHost;
21 }
22
23 class Browser;
24 class PasswordManager;
25 @class PasswordGenerationBubbleController;
26
27 // Customized text field that is used to display the regenerate icon.
28 @interface PasswordGenerationTextField : StyledTextField {
29 }
30
31 - (id)initWithFrame:(NSRect)frame
32      withController:(PasswordGenerationBubbleController*)controller
33         normalImage:(NSImage*)normalImage
34          hoverImage:(NSImage*)hoverImage;
35 @end
36
37 @interface PasswordGenerationBubbleController :
38     BaseBubbleController<NSTextFieldDelegate> {
39  @private
40   // |renderViewHost_| and |passwordManager_| may be nil in testing.
41   content::RenderViewHost* renderViewHost_;
42   PasswordManager* passwordManager_;
43   autofill::PasswordGenerator* passwordGenerator_;
44   autofill::PasswordForm form_;
45   autofill::password_generation::PasswordGenerationActions actions_;
46
47   PasswordGenerationTextField* textField_;   // weak
48 }
49
50 @property(readonly) PasswordGenerationTextField* textField;
51
52 - (id)initWithWindow:(NSWindow*)parentWindow
53           anchoredAt:(NSPoint)point
54       renderViewHost:(content::RenderViewHost*)renderViewHost
55      passwordManager:(PasswordManager*)passwordManager
56       usingGenerator:(autofill::PasswordGenerator*)passwordGenerator
57              forForm:(const autofill::PasswordForm&)form;
58 - (void)performLayout;
59 - (IBAction)fillPassword:(id)sender;
60 - (void)regeneratePassword;
61 @end
62
63 // Testing interfaces
64
65 @interface PasswordGenerationTextField (ExposedForTesting)
66 - (void)simulateIconClick;
67 @end
68
69 #endif  // CHROME_BROWSER_UI_COCOA_BROWSER_PASSWORD_GENERATION_BUBBLE_CONTROLLER_H_