Chromium Code Reviews| 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" | |
|
please use gerrit instead
2015/08/07 23:02:27
base/callback_forward.h or something.
hcarmona
2015/08/11 02:35:46
Done.
| |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "components/bubble/bubble_ui.h" | |
| 12 #include "ui/gfx/native_widget_types.h" | |
| 13 | |
| 14 class BubbleDelegate; | |
| 15 class BubbleManager; | |
| 16 | |
| 17 enum BubbleCloseReason { | |
| 18 // Bubble was closed without any user interaction. | |
| 19 BUBBLE_CLOSE_IGNORE = 0, | |
|
please use gerrit instead
2015/08/07 23:02:27
= 0 not needed
hcarmona
2015/08/11 02:35:46
Done.
| |
| 20 | |
| 21 // User did not interact with the bubble, but changed tab. | |
| 22 BUBBLE_CLOSE_TABSWITCH, | |
| 23 | |
| 24 // User dismissed the bubble. (ESC, close, etc) | |
| 25 BUBBLE_CLOSE_CLOSE, | |
| 26 | |
| 27 // User selected the "Allow" option in a bubble. | |
| 28 BUBBLE_CLOSE_ALLOW, | |
| 29 | |
| 30 // User selected the "Deny" option in a bubble. | |
| 31 BUBBLE_CLOSE_DENY, | |
| 32 }; | |
| 33 | |
| 34 /* | |
| 35 * Only the BubbleManager should know of and use the BubbleController. | |
| 36 */ | |
|
please use gerrit instead
2015/08/07 23:02:27
//
also, what does it do? \o/
hcarmona
2015/08/11 02:35:46
Done.
| |
| 37 class BubbleController : public base::SupportsWeakPtr<BubbleController> { | |
| 38 public: | |
| 39 BubbleController(BubbleManager* manager, scoped_ptr<BubbleDelegate> delegate); | |
| 40 virtual ~BubbleController(); | |
|
please use gerrit instead
2015/08/07 23:02:27
override
hcarmona
2015/08/11 02:35:46
Acknowledged.
| |
| 41 | |
| 42 void Show(); | |
| 43 void Hide(BubbleCloseReason reason); | |
| 44 void UpdateAnchorPosition(); | |
| 45 | |
| 46 bool ShouldClose(); | |
| 47 void Close(); | |
| 48 | |
| 49 bool IsOwnerOf(BubbleDelegate* delegate); | |
| 50 bool MatchesContext(void* context); | |
|
hcarmona
2015/08/07 23:02:38
Update design doc: what is "context"
| |
| 51 | |
| 52 private: | |
| 53 // Weak. | |
| 54 BubbleManager* manager_; | |
|
please use gerrit instead
2015/08/07 23:02:27
may not be necessary
hcarmona
2015/08/11 02:35:46
Done.
| |
| 55 | |
| 56 scoped_ptr<BubbleDelegate> delegate_; | |
| 57 scoped_ptr<BubbleUI> bubble_ui_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(BubbleController); | |
| 60 }; | |
| 61 | |
| 62 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__ | |
| OLD | NEW |