| OLD | NEW |
| (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 #include "components/bubble/bubble_controller.h" |
| 6 |
| 7 #include "components/bubble/bubble_delegate.h" |
| 8 #include "components/bubble/bubble_manager.h" |
| 9 |
| 10 BubbleController::BubbleController(BubbleManager* manager, |
| 11 scoped_ptr<BubbleDelegate> delegate) |
| 12 : manager_(manager), delegate_(delegate.Pass()), bubble_ui_(nullptr) { |
| 13 DCHECK(manager_); |
| 14 DCHECK(delegate_); |
| 15 } |
| 16 |
| 17 BubbleController::~BubbleController() {} |
| 18 |
| 19 void BubbleController::Show() { |
| 20 bubble_ui_ = delegate_->BuildBubbleUI(); |
| 21 |
| 22 DCHECK(bubble_ui_); |
| 23 bubble_ui_->Show(); |
| 24 } |
| 25 |
| 26 void BubbleController::Hide(BubbleCloseReason reason) { |
| 27 DCHECK(bubble_ui_); |
| 28 bubble_ui_->Hide(); |
| 29 } |
| 30 |
| 31 void BubbleController::UpdateAnchorPosition() { |
| 32 DCHECK(bubble_ui_); |
| 33 bubble_ui_->UpdateAnchorPosition(); |
| 34 } |
| 35 |
| 36 bool BubbleController::IsOwnerOf(BubbleDelegate* delegate) { |
| 37 return delegate == delegate_.get(); |
| 38 } |
| 39 |
| 40 bool BubbleController::MatchesContext(void* context) { |
| 41 return delegate_->GetContext() == context; |
| 42 } |
| OLD | NEW |