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

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: Fix trybots pt2 Created 5 years, 3 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_close_reason.h"
11
12 class BubbleDelegate;
13 class BubbleManager;
14 class BubbleUI;
15
16 // BubbleController is responsible for the lifetime of the delegate and its UI.
17 class BubbleController : public base::SupportsWeakPtr<BubbleController> {
18 public:
19 explicit BubbleController(BubbleManager* manager,
20 scoped_ptr<BubbleDelegate> delegate);
21 virtual ~BubbleController();
22
23 // Will call CloseBubble on the manager that this bubble reference is
msw 2015/08/26 01:42:36 nit: consider one-liner: "Calls CloseBubble on the
hcarmona 2015/08/26 17:25:58 Done.
24 // associated with.
25 bool CloseBubble(BubbleCloseReason reason);
26
27 private:
28 friend class BubbleManager;
29
30 // Will create and show the UI for the delegate.
31 void Show();
32
33 // Will notify the bubble UI that it should update its anchor location.
34 // Important when there's a UI change (ex: fullscreen transition).
35 void UpdateAnchorPosition();
36
37 // Will clean up the delegate and its UI if it closed.
38 // Returns true if the bubble was closed.
39 bool ShouldClose(BubbleCloseReason reason);
40
41 BubbleManager* manager_;
42 scoped_ptr<BubbleDelegate> delegate_;
43 scoped_ptr<BubbleUI> bubble_ui_;
44
45 DISALLOW_COPY_AND_ASSIGN(BubbleController);
46 };
47
48 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698