OLD | NEW |
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 #include "components/bubble/bubble_manager.h" | 5 #include "components/bubble/bubble_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "components/bubble/bubble_controller.h" | 10 #include "components/bubble/bubble_controller.h" |
11 #include "components/bubble/bubble_delegate.h" | 11 #include "components/bubble/bubble_delegate.h" |
12 | 12 |
13 BubbleManager::BubbleManager() : manager_state_(SHOW_BUBBLES) {} | 13 BubbleManager::BubbleManager() : manager_state_(SHOW_BUBBLES) {} |
14 | 14 |
15 BubbleManager::~BubbleManager() { | 15 BubbleManager::~BubbleManager() { |
16 FinalizePendingRequests(); | 16 FinalizePendingRequests(); |
17 } | 17 } |
18 | 18 |
19 BubbleReference BubbleManager::ShowBubble(scoped_ptr<BubbleDelegate> bubble) { | 19 BubbleReference BubbleManager::ShowBubble( |
| 20 std::unique_ptr<BubbleDelegate> bubble) { |
20 DCHECK(thread_checker_.CalledOnValidThread()); | 21 DCHECK(thread_checker_.CalledOnValidThread()); |
21 DCHECK_NE(manager_state_, ITERATING_BUBBLES); | 22 DCHECK_NE(manager_state_, ITERATING_BUBBLES); |
22 DCHECK(bubble); | 23 DCHECK(bubble); |
23 | 24 |
24 scoped_ptr<BubbleController> controller( | 25 std::unique_ptr<BubbleController> controller( |
25 new BubbleController(this, std::move(bubble))); | 26 new BubbleController(this, std::move(bubble))); |
26 | 27 |
27 BubbleReference bubble_ref = controller->AsWeakPtr(); | 28 BubbleReference bubble_ref = controller->AsWeakPtr(); |
28 | 29 |
29 switch (manager_state_) { | 30 switch (manager_state_) { |
30 case SHOW_BUBBLES: | 31 case SHOW_BUBBLES: |
31 controller->Show(); | 32 controller->Show(); |
32 controllers_.push_back(std::move(controller)); | 33 controllers_.push_back(std::move(controller)); |
33 break; | 34 break; |
34 case NO_MORE_BUBBLES: | 35 case NO_MORE_BUBBLES: |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 124 |
124 for (auto controller : close_queue) { | 125 for (auto controller : close_queue) { |
125 controller->DoClose(reason); | 126 controller->DoClose(reason); |
126 | 127 |
127 FOR_EACH_OBSERVER(BubbleManagerObserver, observers_, | 128 FOR_EACH_OBSERVER(BubbleManagerObserver, observers_, |
128 OnBubbleClosed(controller->AsWeakPtr(), reason)); | 129 OnBubbleClosed(controller->AsWeakPtr(), reason)); |
129 } | 130 } |
130 | 131 |
131 return !close_queue.empty(); | 132 return !close_queue.empty(); |
132 } | 133 } |
OLD | NEW |