blob: 14a06e8ac0695fb6f69b9eb6ec05e1a7c0791932 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/bubble/bubble_delegate.h"
#include "views/bubble/bubble_frame_view.h"
#include "views/bubble/bubble_view.h"
#include "base/logging.h"
#include "views/widget/widget.h"
namespace views {
BubbleDelegate* BubbleDelegate::AsBubbleDelegate() { return this; }
ClientView* BubbleDelegate::CreateClientView(Widget* widget) {
BubbleView* bubble_view = new BubbleView(widget, GetContentsView());
bubble_view->SetBounds(0, 0, GetBounds().width(), GetBounds().height());
if (widget->GetFocusManager()) {
widget->GetFocusManager()->RegisterAccelerator(
views::Accelerator(ui::VKEY_ESCAPE, false, false, false),
bubble_view);
}
return bubble_view;
}
NonClientFrameView* BubbleDelegate::CreateNonClientFrameView() {
return new BubbleFrameView(GetWidget(),
GetBounds(),
GetFrameBackgroundColor(),
GetFrameArrowLocation());
}
const BubbleView* BubbleDelegate::GetBubbleView() const {
return GetWidget()->client_view()->AsBubbleView();
}
BubbleView* BubbleDelegate::GetBubbleView() {
return GetWidget()->client_view()->AsBubbleView();
}
const BubbleFrameView* BubbleDelegate::GetBubbleFrameView() const {
return static_cast<BubbleFrameView*>(
GetWidget()->non_client_view()->frame_view());
}
BubbleFrameView* BubbleDelegate::GetBubbleFrameView() {
return static_cast<BubbleFrameView*>(
GetWidget()->non_client_view()->frame_view());
}
BubbleDelegateView::BubbleDelegateView(Widget* frame):frame_(frame) {
}
BubbleDelegateView::~BubbleDelegateView() {
}
Widget* BubbleDelegateView::GetWidget() {
return frame_;
}
const Widget* BubbleDelegateView::GetWidget() const {
return frame_;
}
} // namespace views
|