| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 new BubbleController(this, std::move(bubble))); | 26 new BubbleController(this, std::move(bubble))); |
| 27 | 27 |
| 28 BubbleReference bubble_ref = controller->AsWeakPtr(); | 28 BubbleReference bubble_ref = controller->AsWeakPtr(); |
| 29 | 29 |
| 30 switch (manager_state_) { | 30 switch (manager_state_) { |
| 31 case SHOW_BUBBLES: | 31 case SHOW_BUBBLES: |
| 32 controller->Show(); | 32 controller->Show(); |
| 33 controllers_.push_back(std::move(controller)); | 33 controllers_.push_back(std::move(controller)); |
| 34 break; | 34 break; |
| 35 case NO_MORE_BUBBLES: | 35 case NO_MORE_BUBBLES: |
| 36 FOR_EACH_OBSERVER(BubbleManagerObserver, observers_, | 36 for (auto& observer : observers_) |
| 37 OnBubbleNeverShown(controller->AsWeakPtr())); | 37 observer.OnBubbleNeverShown(controller->AsWeakPtr()); |
| 38 break; | 38 break; |
| 39 default: | 39 default: |
| 40 NOTREACHED(); | 40 NOTREACHED(); |
| 41 break; | 41 break; |
| 42 } | 42 } |
| 43 | 43 |
| 44 return bubble_ref; | 44 return bubble_ref; |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool BubbleManager::CloseBubble(BubbleReference bubble, | 47 bool BubbleManager::CloseBubble(BubbleReference bubble, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 i = controllers_.weak_erase(i); | 118 i = controllers_.weak_erase(i); |
| 119 } else { | 119 } else { |
| 120 ++i; | 120 ++i; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 manager_state_ = original_state; | 123 manager_state_ = original_state; |
| 124 | 124 |
| 125 for (auto* controller : close_queue) { | 125 for (auto* controller : close_queue) { |
| 126 controller->DoClose(reason); | 126 controller->DoClose(reason); |
| 127 | 127 |
| 128 FOR_EACH_OBSERVER(BubbleManagerObserver, observers_, | 128 for (auto& observer : observers_) |
| 129 OnBubbleClosed(controller->AsWeakPtr(), reason)); | 129 observer.OnBubbleClosed(controller->AsWeakPtr(), reason); |
| 130 } | 130 } |
| 131 | 131 |
| 132 return !close_queue.empty(); | 132 return !close_queue.empty(); |
| 133 } | 133 } |
| OLD | NEW |