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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h

Issue 505123002: Revert "Revert of Hook up the Mac password bubble to the browser and add browser tests. (patchset #… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix include for real this time Created 6 years, 3 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #import "chrome/browser/ui/passwords/manage_passwords_bubble.h" 11 #import "chrome/browser/ui/passwords/manage_passwords_bubble.h"
12 12
13 namespace content { 13 namespace content {
14 class WebContents; 14 class WebContents;
15 } 15 }
16 16
17 namespace chrome {
18 void ShowManagePasswordsBubble(content::WebContents* webContents);
19 }
20
17 @class ManagePasswordsBubbleController; 21 @class ManagePasswordsBubbleController;
18 @class ManagePasswordsBubbleCocoaNotificationBridge; 22 @class ManagePasswordsBubbleCocoaNotificationBridge;
23 class ManagePasswordsIcon;
19 24
20 // Cocoa implementation of the platform-independent password bubble interface. 25 // Cocoa implementation of the platform-independent password bubble interface.
21 class ManagePasswordsBubbleCocoa : public ManagePasswordsBubble { 26 class ManagePasswordsBubbleCocoa : public ManagePasswordsBubble {
22 public: 27 public:
23 // Creates and shows the bubble, which owns itself. Does nothing if the bubble 28 // Creates and shows the bubble, which owns itself. Does nothing if the bubble
24 // is already shown. 29 // is already shown.
25 static void ShowBubble(content::WebContents* webContents, 30 static void ShowBubble(content::WebContents* webContents,
26 DisplayReason displayReason); 31 DisplayReason displayReason,
32 ManagePasswordsIcon* icon);
27 33
28 // Closes and deletes the bubble. 34 // Closes and deletes the bubble.
29 void Close(); 35 void Close();
30 36
37 // Sets the location bar icon that should be updated with state changes.
38 void SetIcon(ManagePasswordsIcon* icon) { icon_ = icon; }
39
31 // Accessor for the global bubble. 40 // Accessor for the global bubble.
32 static ManagePasswordsBubbleCocoa* instance() { return bubble_; } 41 static ManagePasswordsBubbleCocoa* instance() { return bubble_; }
33 42
34 private: 43 private:
35 friend class ManagePasswordsBubbleCocoaTest; 44 friend class ManagePasswordsBubbleCocoaTest;
45 friend class ManagePasswordsBubbleTest;
46 friend void chrome::ShowManagePasswordsBubble(
47 content::WebContents* webContents);
36 48
37 // Instance-specific logic. Clients should use the static interface. 49 // Instance-specific logic. Clients should use the static interface.
38 ManagePasswordsBubbleCocoa(content::WebContents* webContents, 50 ManagePasswordsBubbleCocoa(content::WebContents* webContents,
39 DisplayReason displayReason); 51 DisplayReason displayReason,
52 ManagePasswordsIcon* icon);
40 virtual ~ManagePasswordsBubbleCocoa(); 53 virtual ~ManagePasswordsBubbleCocoa();
41 void Show(); 54 void Show();
42 55
43 // Cleans up state and deletes itself. Called when the bubble is closed. 56 // Cleans up state and deletes itself. Called when the bubble is closed.
44 void OnClose(); 57 void OnClose();
45 58
59 // The location bar icon corresponding to the bubble.
60 ManagePasswordsIcon* icon_;
61
46 // Whether there is currently a close operation taking place. Prevents 62 // Whether there is currently a close operation taking place. Prevents
47 // multiple attempts to close the window. 63 // multiple attempts to close the window.
48 bool closing_; 64 bool closing_;
49 65
50 // The view controller for the bubble. Weak; owns itself. Must be nilled 66 // The view controller for the bubble. Weak; owns itself. Must be nilled
51 // after the bubble is closed. 67 // after the bubble is closed.
52 ManagePasswordsBubbleController* controller_; 68 ManagePasswordsBubbleController* controller_;
53 69
54 // WebContents on which the bubble should be displayed. Weak. 70 // WebContents on which the bubble should be displayed. Weak.
55 content::WebContents* webContents_; 71 content::WebContents* webContents_;
56 72
57 // Listens for NSNotificationCenter notifications. 73 // Listens for NSNotificationCenter notifications.
58 base::scoped_nsobject<ManagePasswordsBubbleCocoaNotificationBridge> bridge_; 74 base::scoped_nsobject<ManagePasswordsBubbleCocoaNotificationBridge> bridge_;
59 75
60 // The global bubble instance. Deleted by Close(). 76 // The global bubble instance. Deleted by Close().
61 static ManagePasswordsBubbleCocoa* bubble_; 77 static ManagePasswordsBubbleCocoa* bubble_;
62 78
63 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleCocoa); 79 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleCocoa);
64 }; 80 };
65 81
66 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_ 82 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698