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

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

Issue 1251633002: Add BubbleManager to manage bubbles and ChromeBubbleManager for events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years, 4 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 #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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698