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

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

Issue 1310483003: Add ability for a BubbleReference to update the BubbleUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bm-reference-own-file.gitbr
Patch Set: Add UI thread checks to controller 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
« no previous file with comments | « no previous file | components/bubble/bubble_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ 5 #ifndef COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
6 #define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ 6 #define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread_checker.h"
10 #include "components/bubble/bubble_close_reason.h" 11 #include "components/bubble/bubble_close_reason.h"
11 12
12 class BubbleDelegate; 13 class BubbleDelegate;
13 class BubbleManager; 14 class BubbleManager;
14 class BubbleUI; 15 class BubbleUi;
15 16
16 // BubbleController is responsible for the lifetime of the delegate and its UI. 17 // BubbleController is responsible for the lifetime of the delegate and its UI.
17 class BubbleController : public base::SupportsWeakPtr<BubbleController> { 18 class BubbleController : public base::SupportsWeakPtr<BubbleController> {
18 public: 19 public:
19 explicit BubbleController(BubbleManager* manager, 20 explicit BubbleController(BubbleManager* manager,
20 scoped_ptr<BubbleDelegate> delegate); 21 scoped_ptr<BubbleDelegate> delegate);
21 virtual ~BubbleController(); 22 virtual ~BubbleController();
22 23
23 // Calls CloseBubble on the associated BubbleManager. 24 // Calls CloseBubble on the associated BubbleManager.
24 bool CloseBubble(BubbleCloseReason reason); 25 bool CloseBubble(BubbleCloseReason reason);
25 26
27 // Calls UpdateBubbleUi on the associated BubbleManager.
28 // Returns true if the UI was updated.
29 bool UpdateBubbleUi();
30
26 private: 31 private:
27 friend class BubbleManager; 32 friend class BubbleManager;
28 33
29 // Creates and shows the UI for the delegate. 34 // Creates and shows the UI for the delegate.
30 void Show(); 35 void Show();
31 36
32 // Notifies the bubble UI that it should update its anchor location. 37 // Notifies the bubble UI that it should update its anchor location.
33 // Important when there's a UI change (ex: fullscreen transition). 38 // Important when there's a UI change (ex: fullscreen transition).
34 void UpdateAnchorPosition(); 39 void UpdateAnchorPosition();
35 40
36 // Cleans up the delegate and its UI if it closed. 41 // Cleans up the delegate and its UI if it closed.
37 // Returns true if the bubble was closed. 42 // Returns true if the bubble was closed.
38 bool ShouldClose(BubbleCloseReason reason); 43 bool ShouldClose(BubbleCloseReason reason);
39 44
40 BubbleManager* manager_; 45 BubbleManager* manager_;
41 scoped_ptr<BubbleDelegate> delegate_; 46 scoped_ptr<BubbleDelegate> delegate_;
42 scoped_ptr<BubbleUI> bubble_ui_; 47 scoped_ptr<BubbleUi> bubble_ui_;
48
49 // Verify that functions that affect the UI are done on the same thread.
50 base::ThreadChecker thread_checker_;
43 51
44 DISALLOW_COPY_AND_ASSIGN(BubbleController); 52 DISALLOW_COPY_AND_ASSIGN(BubbleController);
45 }; 53 };
46 54
47 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ 55 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | components/bubble/bubble_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698