| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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 COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__ |
| 6 #define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__ |
| 7 |
| 8 #include "base/callback.h" |
| 9 |
| 10 class BubbleDelegate; |
| 11 class BubbleManager; |
| 12 |
| 13 enum BubbleCloseReason { |
| 14 // Bubble was closed without any user interaction. |
| 15 BUBBLE_CLOSE_IGNORE = 0, |
| 16 |
| 17 // User did not interact with the bubble, but changed tab. |
| 18 BUBBLE_CLOSE_TABSWITCH, |
| 19 |
| 20 // User dismissed the bubble. (ESC, close, etc) |
| 21 BUBBLE_CLOSE_CLOSE, |
| 22 |
| 23 // User selected the "Allow" option in a bubble. |
| 24 BUBBLE_CLOSE_ALLOW, |
| 25 |
| 26 // User selected the "Deny" option in a bubble. |
| 27 BUBBLE_CLOSE_DENY, |
| 28 }; |
| 29 |
| 30 class BubbleController { |
| 31 public: |
| 32 typedef base::Callback<scoped_ptr<BubbleController>(BubbleManager*, |
| 33 BubbleDelegate*)> Factory; |
| 34 |
| 35 BubbleController(BubbleManager* manager, BubbleDelegate* delegate); |
| 36 virtual ~BubbleController(); |
| 37 |
| 38 virtual void Show(); |
| 39 virtual void Hide(BubbleCloseReason reason); |
| 40 |
| 41 virtual void UpdatePosition(); |
| 42 |
| 43 bool IsOwnerOf(BubbleDelegate* delegate) { return delegate == delegate_; } |
| 44 |
| 45 static scoped_ptr<BubbleController> Create(BubbleManager* manager, |
| 46 BubbleDelegate* delegate); |
| 47 private: |
| 48 // Weak. |
| 49 BubbleManager* manager_; |
| 50 |
| 51 // Weak. |
| 52 BubbleDelegate* delegate_; |
| 53 }; |
| 54 |
| 55 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__ |
| OLD | NEW |