OLD | NEW |
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_PASSWORDS_BUBBLE_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_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 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #import "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 12 #import "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 @class ManagePasswordsBubbleController; | 18 @class ManagePasswordsBubbleController; |
19 @class ManagePasswordsBubbleCocoaNotificationBridge; | 19 @class ManagePasswordsBubbleCocoaNotificationBridge; |
20 class ManagePasswordsIcon; | 20 class ManagePasswordsIcon; |
21 | 21 |
22 // Cocoa implementation of the platform-independent password bubble interface. | 22 // Cocoa implementation of the platform-independent password bubble interface. |
23 class ManagePasswordsBubbleCocoa { | 23 class ManagePasswordsBubbleCocoa { |
24 public: | 24 public: |
25 // Creates and shows the bubble, which owns itself. Does nothing if the bubble | 25 // Creates and shows the bubble, which owns itself. Does nothing if the bubble |
26 // is already shown. | 26 // is already shown. |
27 static void Show(content::WebContents* webContents, bool user_action); | 27 static void Show(content::WebContents* webContents, bool user_action); |
28 | 28 |
| 29 // Closes the bubble. Does nothing if the bubble is not currently shown. |
| 30 static void CloseCurrentBubble(); |
| 31 |
29 // Closes and deletes the bubble. | 32 // Closes and deletes the bubble. |
30 void Close(bool no_animation); | 33 void Close(bool no_animation); |
31 void Close(); | 34 void Close(); |
32 | 35 |
33 // Sets the location bar icon that should be updated with state changes. | 36 // Sets the location bar icon that should be updated with state changes. |
34 void SetIcon(ManagePasswordsIcon* icon) { icon_ = icon; } | 37 void SetIcon(ManagePasswordsIcon* icon) { icon_ = icon; } |
35 | 38 |
36 // Accessor for the global bubble. | 39 // Accessor for the global bubble. |
37 static ManagePasswordsBubbleCocoa* instance() { return bubble_; } | 40 static ManagePasswordsBubbleCocoa* instance() { return bubble_; } |
38 | 41 |
(...skipping 26 matching lines...) Expand all Loading... |
65 | 68 |
66 // Listens for NSNotificationCenter notifications. | 69 // Listens for NSNotificationCenter notifications. |
67 base::scoped_nsobject<ManagePasswordsBubbleCocoaNotificationBridge> bridge_; | 70 base::scoped_nsobject<ManagePasswordsBubbleCocoaNotificationBridge> bridge_; |
68 | 71 |
69 // The global bubble instance. Deleted by Close(). | 72 // The global bubble instance. Deleted by Close(). |
70 static ManagePasswordsBubbleCocoa* bubble_; | 73 static ManagePasswordsBubbleCocoa* bubble_; |
71 | 74 |
72 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleCocoa); | 75 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleCocoa); |
73 }; | 76 }; |
74 | 77 |
| 78 // Helper to hide a toolkit-views manage passwords bubble. Implemented in a |
| 79 // views-specific file. |
| 80 void CloseViewsManagePasswordsBubbleOnCocoaBrowser(); |
| 81 |
| 82 // Helper to show a toolkit-views manage passwords bubble. Implemented in a |
| 83 // views-specific file. |
| 84 void ShowViewsManagePasswordsBubbleOnCocoaBrowser( |
| 85 NSPoint anchor, |
| 86 content::WebContents* web_contents, |
| 87 bool user_action); |
| 88 |
75 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_COCOA_H_ | 89 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_COCOA_H_ |
OLD | NEW |