OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 #include "base/mac/scoped_nsobject.h" |
| 11 #import "chrome/browser/ui/passwords/manage_passwords_bubble.h" |
| 12 |
| 13 namespace content { |
| 14 class WebContents; |
| 15 } |
| 16 |
| 17 @class ManagePasswordsBubbleController; |
| 18 @class ManagePasswordsBubbleCocoaNotificationBridge; |
| 19 |
| 20 // Cocoa implementation of the platform-independent password bubble interface. |
| 21 class ManagePasswordsBubbleCocoa : public ManagePasswordsBubble { |
| 22 public: |
| 23 // Creates and shows the bubble, which owns itself. Does nothing if the bubble |
| 24 // is already shown. |
| 25 static void ShowBubble(content::WebContents* webContents, |
| 26 DisplayReason displayReason); |
| 27 |
| 28 // Closes and deletes the bubble. |
| 29 void Close(); |
| 30 |
| 31 // Accessor for the global bubble. |
| 32 static ManagePasswordsBubbleCocoa* instance() { return bubble_; } |
| 33 |
| 34 private: |
| 35 friend class ManagePasswordsBubbleCocoaTest; |
| 36 |
| 37 // Instance-specific logic. Clients should use the static interface. |
| 38 ManagePasswordsBubbleCocoa(content::WebContents* webContents, |
| 39 DisplayReason displayReason); |
| 40 virtual ~ManagePasswordsBubbleCocoa(); |
| 41 void Show(); |
| 42 |
| 43 // Cleans up state and deletes itself. Called when the bubble is closed. |
| 44 void OnClose(); |
| 45 |
| 46 // Whether there is currently a close operation taking place. Prevents |
| 47 // multiple attempts to close the window. |
| 48 bool closing_; |
| 49 |
| 50 // The view controller for the bubble. Weak; owns itself. Must be nilled |
| 51 // after the bubble is closed. |
| 52 ManagePasswordsBubbleController* controller_; |
| 53 |
| 54 // WebContents on which the bubble should be displayed. Weak. |
| 55 content::WebContents* webContents_; |
| 56 |
| 57 // Listens for NSNotificationCenter notifications. |
| 58 base::scoped_nsobject<ManagePasswordsBubbleCocoaNotificationBridge> bridge_; |
| 59 |
| 60 // The global bubble instance. Deleted by Close(). |
| 61 static ManagePasswordsBubbleCocoa* bubble_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleCocoa); |
| 64 }; |
| 65 |
| 66 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_COCOA_H_ |
OLD | NEW |