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

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: Apply Feedback 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__
msw 2015/08/13 03:37:22 nit: remove extra trailing underscore here and bel
hcarmona 2015/08/15 02:03:19 Done.
6 #define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__
7
8 #include "base/callback_forward.h"
msw 2015/08/13 03:37:22 nit: remove if not needed.
hcarmona 2015/08/15 02:03:19 Done.
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "components/bubble/bubble_ui.h"
msw 2015/08/13 03:37:22 nit: forward declare BubbleUI (like BubbleDelegate
hcarmona 2015/08/15 02:03:19 Done.
12 #include "ui/gfx/native_widget_types.h"
msw 2015/08/13 03:37:22 nit: remove if not needed.
hcarmona 2015/08/15 02:03:19 Done.
13
14 class BubbleDelegate;
15
16 enum BubbleCloseReason {
17 // Bubble was closed without any user interaction.
18 BUBBLE_CLOSE_IGNORE,
19
20 // User did not interact with the bubble, but changed tab.
msw 2015/08/13 03:37:22 What's the value of distinguishing this from *_IGN
groby-ooo-7-16 2015/08/13 18:44:38 There's potentially a different meaning to this -
msw 2015/08/13 19:18:58 Okay, reasonable, but perhaps better generalized a
21 BUBBLE_CLOSE_TABSWITCH,
22
23 // User dismissed the bubble. (ESC, close, etc)
msw 2015/08/13 03:37:22 nit: period after "etc"
hcarmona 2015/08/15 02:03:19 Done.
24 BUBBLE_CLOSE_CLOSE,
25
26 // User selected the "Allow" option in a bubble.
msw 2015/08/13 03:37:22 Most bubbles won't have "Allow" and "Deny" options
groby-ooo-7-16 2015/08/13 18:44:38 This definitely refers to the positive/negative re
msw 2015/08/13 19:18:58 That might be okay, but allow/deny is much more pe
hcarmona 2015/08/15 02:03:19 Done.
27 BUBBLE_CLOSE_ALLOW,
28
29 // User selected the "Deny" option in a bubble.
30 BUBBLE_CLOSE_DENY,
31 };
32
33 // BubbleController is responisble for the lifetime of the delegate and it's UI.
msw 2015/08/13 03:37:22 nit: no apostrophe in "its" here.
msw 2015/08/13 19:18:58 nit: responsible spelling.
hcarmona 2015/08/15 02:03:19 Done.
hcarmona 2015/08/15 02:03:19 Done.
34 class BubbleController {
35 public:
36 explicit BubbleController(scoped_ptr<BubbleDelegate> delegate);
37 virtual ~BubbleController();
38
39 void Show();
40 void Hide(BubbleCloseReason reason);
41 void UpdateAnchorPosition();
42 bool ShouldUpdateBubble();
msw 2015/08/13 03:37:22 nit: add comments here and for other non-obvious f
hcarmona 2015/08/15 02:03:19 Done.
43
44 bool ShouldClose() const;
msw 2015/08/13 03:37:22 nit: ShouldCloseOnHide? add comments here and for
hcarmona 2015/08/15 02:03:19 Acknowledged.
45 void Close();
46
47 bool MatchesContext(void* context) const;
msw 2015/08/13 03:37:22 nit: add comments here and for other non-obvious f
hcarmona 2015/08/15 02:03:19 Done.
48
49 base::WeakPtr<BubbleController> AsWeakPtr();
50
51 private:
52 scoped_ptr<BubbleDelegate> delegate_;
53 scoped_ptr<BubbleUI> bubble_ui_;
54
55 base::WeakPtrFactory<BubbleController> weak_ptr_factory_;
56
57 DISALLOW_COPY_AND_ASSIGN(BubbleController);
58 };
59
60 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698