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

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: Mac Changes to test trybots 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/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/bubble/bubble_delegate.h"
msw 2015/08/18 17:26:19 nit: remove this, forward-declare BubbleDelegate,
hcarmona 2015/08/18 23:08:48 Need BubbleCloseReason.
msw 2015/08/19 00:18:11 Acknowledged.
11
12 class BubbleUI;
13
14 // BubbleController is responsible for the lifetime of the delegate and its UI.
15 class BubbleController {
msw 2015/08/18 17:26:19 Make this a SupportsWeakPtr subclass, remove the f
hcarmona 2015/08/18 23:08:48 I didn't use SupportsWeakPtr because it's necessar
msw 2015/08/19 00:18:11 So the problem is that SupportsWeakPtr's "internal
groby-ooo-7-16 2015/08/19 00:52:01 There's also the point that WeakPtrFactory is _by
hcarmona 2015/08/20 02:34:31 We now have better chaining, so we can use Support
msw 2015/08/21 01:48:30 With the Show/ShouldClose/etc. functions private,
16 public:
17 explicit BubbleController(scoped_ptr<BubbleDelegate> delegate);
18 virtual ~BubbleController();
19
20 // Will create and show the UI for the delegate.
21 void Show();
22
23 // Will notify the bubble UI that it should update its anchor location.
24 // Important when there's a UI change (ex: fullscreen transition).
25 void UpdateAnchorPosition();
26
27 // Should clean up the delegate and its UI if it closed.
msw 2015/08/18 17:26:19 nit: s/Should/Will/ to match other comments.
hcarmona 2015/08/18 23:08:48 Done.
28 // Returns true if the bubble was closed.
29 bool ShouldClose(BubbleCloseReason reason);
30
31 base::WeakPtr<BubbleController> AsWeakPtr();
32
33 private:
34 scoped_ptr<BubbleDelegate> delegate_;
35 scoped_ptr<BubbleUI> bubble_ui_;
36
37 base::WeakPtrFactory<BubbleController> weak_ptr_factory_;
38
39 DISALLOW_COPY_AND_ASSIGN(BubbleController);
40 };
41
42 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698