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

Side by Side Diff: components/bubble/bubble_controller.h

Issue 1251633002: Add BubbleManager to manage bubbles and ChromeBubbleManager for events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years, 4 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
(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 #include "base/memory/scoped_ptr.h"
10 #include "components/bubble/bubble_ui.h"
11 #include "ui/gfx/native_widget_types.h"
12
13 class BubbleDelegate;
14 class BubbleManager;
15
16 enum BubbleCloseReason {
17 // Bubble was closed without any user interaction.
18 BUBBLE_CLOSE_IGNORE = 0,
19
20 // User did not interact with the bubble, but changed tab.
21 BUBBLE_CLOSE_TABSWITCH,
22
23 // User dismissed the bubble. (ESC, close, etc)
24 BUBBLE_CLOSE_CLOSE,
25
26 // User selected the "Allow" option in a bubble.
27 BUBBLE_CLOSE_ALLOW,
28
29 // User selected the "Deny" option in a bubble.
30 BUBBLE_CLOSE_DENY,
31 };
32
33 /*
34 * Only the BubbleManager should know of and use the BubbleController.
35 */
36 class BubbleController {
37 public:
38 BubbleController(BubbleManager* manager, scoped_ptr<BubbleDelegate> delegate);
39 virtual ~BubbleController();
40
41 void Show();
42 void Hide(BubbleCloseReason reason);
43 void UpdateAnchorPosition();
44
45 bool IsOwnerOf(BubbleDelegate* delegate);
46 bool MatchesContext(void* context);
47
48 private:
49 // Weak.
50 BubbleManager* manager_;
51
52 scoped_ptr<BubbleDelegate> delegate_;
53 scoped_ptr<BubbleUI> bubble_ui_;
54 };
55
56 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698