Commit 25509621 authored by estade's avatar estade Committed by Commit bot

Vanquish views::BubbleDelegate{View,}

BUG=585312

Review URL: https://codereview.chromium.org/1922813002

Cr-Commit-Position: refs/heads/master@{#389915}
parent 78685fb2
......@@ -24,7 +24,6 @@
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/screen.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_dialog_delegate.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
......@@ -64,19 +63,6 @@ const int kSwipeVerticalThresholdMultiplier = 3;
// See ShouldIgnoreMouseEventAtLocation() for more details.
const int kHeightOfDeadRegionAboveTopContainer = 10;
// Returns the BubbleDelegateView corresponding to |maybe_bubble| if
// |maybe_bubble| is a bubble. TODO(estade): remove this when all bubbles are
// BubbleDialogDelegateViews, or create a common interface for the two bubble
// types.
views::BubbleDelegateView* AsBubbleDelegate(aura::Window* maybe_bubble) {
if (!maybe_bubble)
return nullptr;
views::Widget* widget = views::Widget::GetWidgetForNativeView(maybe_bubble);
if (!widget)
return nullptr;
return widget->widget_delegate()->AsBubbleDelegate();
}
// Returns the BubbleDialogDelegateView corresponding to |maybe_bubble| if
// |maybe_bubble| is a bubble.
views::BubbleDialogDelegateView* AsBubbleDialogDelegate(
......@@ -90,10 +76,6 @@ views::BubbleDialogDelegateView* AsBubbleDialogDelegate(
}
views::View* GetAnchorView(aura::Window* maybe_bubble) {
views::BubbleDelegateView* bubble = AsBubbleDelegate(maybe_bubble);
if (bubble)
return bubble->GetAnchorView();
views::BubbleDialogDelegateView* bubble_dialog =
AsBubbleDialogDelegate(maybe_bubble);
return bubble_dialog ? bubble_dialog->GetAnchorView() : nullptr;
......@@ -188,10 +170,8 @@ ImmersiveFullscreenController::BubbleObserver::BubbleObserver(
: controller_(controller) {}
ImmersiveFullscreenController::BubbleObserver::~BubbleObserver() {
for (std::set<aura::Window*>::const_iterator it = bubbles_.begin();
it != bubbles_.end(); ++it) {
(*it)->RemoveObserver(this);
}
for (aura::Window* bubble : bubbles_)
bubble->RemoveObserver(this);
}
void ImmersiveFullscreenController::BubbleObserver::StartObserving(
......@@ -212,9 +192,8 @@ void ImmersiveFullscreenController::BubbleObserver::StopObserving(
void ImmersiveFullscreenController::BubbleObserver::UpdateRevealedLock() {
bool has_visible_bubble = false;
for (std::set<aura::Window*>::const_iterator it = bubbles_.begin();
it != bubbles_.end(); ++it) {
if ((*it)->IsVisible()) {
for (aura::Window* bubble : bubbles_) {
if (bubble->IsVisible()) {
has_visible_bubble = true;
break;
}
......@@ -237,16 +216,10 @@ void ImmersiveFullscreenController::BubbleObserver::UpdateRevealedLock() {
// Currently, there is no nice way for bubbles to reposition themselves
// whenever the anchor view moves. Tell the bubbles to reposition themselves
// explicitly instead. The hidden bubbles are also repositioned because
// BubbleDelegateView does not reposition its widget as a result of a
// BubbleDialogDelegateView does not reposition its widget as a result of a
// visibility change.
for (std::set<aura::Window*>::const_iterator it = bubbles_.begin();
it != bubbles_.end(); ++it) {
views::BubbleDelegateView* bubble = AsBubbleDelegate(*it);
if (bubble)
bubble->OnAnchorBoundsChanged();
else
AsBubbleDialogDelegate(*it)->OnAnchorBoundsChanged();
}
for (aura::Window* bubble : bubbles_)
AsBubbleDialogDelegate(bubble)->OnAnchorBoundsChanged();
}
}
......
......@@ -25,7 +25,7 @@
#include "ui/events/test/event_generator.h"
#include "ui/events/test/test_event_handler.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_dialog_delegate.h"
#include "ui/views/controls/native/native_view_host.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
......@@ -34,6 +34,16 @@ namespace ash {
namespace {
class TestBubbleDialogDelegate : public views::BubbleDialogDelegateView {
public:
explicit TestBubbleDialogDelegate(views::View* anchor)
: BubbleDialogDelegateView(anchor, views::BubbleBorder::NONE) {}
~TestBubbleDialogDelegate() override {}
private:
DISALLOW_COPY_AND_ASSIGN(TestBubbleDialogDelegate);
};
class MockImmersiveFullscreenControllerDelegate
: public ImmersiveFullscreenController::Delegate {
public:
......@@ -665,10 +675,10 @@ TEST_F(ImmersiveFullscreenControllerTest, DifferentModalityEnterExit) {
}
// Test when the SWIPE_CLOSE edge gesture closes the top-of-window views.
#if defined(OS_WIN)
// On Windows, touch events do not result in mouse events being disabled. As
// a result, the last part of this test which ends the reveal via a gesture will
// not work correctly. See crbug.com/332430, and the function
#if !defined(OS_CHROMEOS)
// On Windows/Linux, touch events do not result in mouse events being disabled.
// As a result, the last part of this test which ends the reveal via a gesture
// will not work correctly. See crbug.com/332430, and the function
// ShouldHideCursorOnTouch() in compound_event_filter.cc.
#define MAYBE_EndRevealViaGesture DISABLED_EndRevealViaGesture
#else
......@@ -914,8 +924,8 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
// 1) Test that a bubble anchored to a child of the top container triggers
// a reveal and keeps the top-of-window views revealed for the duration of
// its visibility.
views::Widget* bubble_widget1(views::BubbleDelegateView::CreateBubble(
new views::BubbleDelegateView(child_view, views::BubbleBorder::NONE)));
views::Widget* bubble_widget1(views::BubbleDialogDelegateView::CreateBubble(
new TestBubbleDialogDelegate(child_view)));
bubble_widget1->Show();
EXPECT_TRUE(controller()->IsRevealed());
......@@ -926,8 +936,8 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
ImmersiveFullscreenController::ANIMATE_REVEAL_NO));
EXPECT_TRUE(controller()->IsRevealed());
views::Widget* bubble_widget2 = views::BubbleDelegateView::CreateBubble(
new views::BubbleDelegateView(child_view, views::BubbleBorder::NONE));
views::Widget* bubble_widget2 = views::BubbleDialogDelegateView::CreateBubble(
new TestBubbleDialogDelegate(child_view));
bubble_widget2->Show();
EXPECT_TRUE(controller()->IsRevealed());
revealed_lock.reset();
......@@ -939,8 +949,8 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
// 2) Test that transitioning from keeping the top-of-window views revealed
// because of a bubble to keeping the top-of-window views revealed because of
// mouse hover by activating |top_container_widget| works.
views::Widget* bubble_widget3 = views::BubbleDelegateView::CreateBubble(
new views::BubbleDelegateView(child_view, views::BubbleBorder::NONE));
views::Widget* bubble_widget3 = views::BubbleDialogDelegateView::CreateBubble(
new TestBubbleDialogDelegate(child_view));
bubble_widget3->Show();
SetHovered(true);
EXPECT_TRUE(controller()->IsRevealed());
......@@ -952,18 +962,18 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
SetHovered(false);
EXPECT_FALSE(controller()->IsRevealed());
views::BubbleDelegateView* bubble_delegate4(new views::BubbleDelegateView(
child_view, views::BubbleBorder::NONE));
views::BubbleDialogDelegateView* bubble_delegate4(
new TestBubbleDialogDelegate(child_view));
bubble_delegate4->set_can_activate(false);
views::Widget* bubble_widget4(views::BubbleDelegateView::CreateBubble(
bubble_delegate4));
views::Widget* bubble_widget4(
views::BubbleDialogDelegateView::CreateBubble(bubble_delegate4));
bubble_widget4->Show();
views::BubbleDelegateView* bubble_delegate5(new views::BubbleDelegateView(
child_view, views::BubbleBorder::NONE));
views::BubbleDialogDelegateView* bubble_delegate5(
new TestBubbleDialogDelegate(child_view));
bubble_delegate5->set_can_activate(false);
views::Widget* bubble_widget5(views::BubbleDelegateView::CreateBubble(
bubble_delegate5));
views::Widget* bubble_widget5(
views::BubbleDialogDelegateView::CreateBubble(bubble_delegate5));
bubble_widget5->Show();
EXPECT_TRUE(controller()->IsRevealed());
......@@ -989,8 +999,8 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
// handled upon reenabling immersive fullscreen.
SetEnabled(false);
views::Widget* bubble_widget6 = views::BubbleDelegateView::CreateBubble(
new views::BubbleDelegateView(child_view, views::BubbleBorder::NONE));
views::Widget* bubble_widget6 = views::BubbleDialogDelegateView::CreateBubble(
new TestBubbleDialogDelegate(child_view));
bubble_widget6->Show();
SetEnabled(true);
......@@ -1001,8 +1011,8 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
// 6) Test that a bubble which is not anchored to a child of the
// TopContainerView does not trigger a reveal or keep the
// top-of-window views revealed if they are already revealed.
views::Widget* bubble_widget7 = views::BubbleDelegateView::CreateBubble(
new views::BubbleDelegateView(unrelated_view, views::BubbleBorder::NONE));
views::Widget* bubble_widget7 = views::BubbleDialogDelegateView::CreateBubble(
new TestBubbleDialogDelegate(unrelated_view));
bubble_widget7->Show();
EXPECT_FALSE(controller()->IsRevealed());
......@@ -1011,8 +1021,8 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
AttemptReveal(MODALITY_MOUSE);
EXPECT_TRUE(controller()->IsRevealed());
views::Widget* bubble_widget8 = views::BubbleDelegateView::CreateBubble(
new views::BubbleDelegateView(unrelated_view, views::BubbleBorder::NONE));
views::Widget* bubble_widget8 = views::BubbleDialogDelegateView::CreateBubble(
new TestBubbleDialogDelegate(unrelated_view));
bubble_widget8->Show();
SetHovered(false);
EXPECT_FALSE(controller()->IsRevealed());
......
......@@ -71,7 +71,7 @@ class SaveCardBubbleViews : public SaveCardBubbleView,
std::unique_ptr<views::View> CreateMainContentView();
// views::BubbleDelegateView
// views::BubbleDialogDelegateView
void Init() override;
SaveCardBubbleController* controller_; // Weak reference.
......
......@@ -9,7 +9,7 @@
#include "chrome/browser/ui/views/toolbar/app_menu_button.h"
#include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_dialog_delegate.h"
namespace {
......
......@@ -13,7 +13,6 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/extension_icon_image.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/label.h"
......
......@@ -38,7 +38,7 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_dialog_delegate.h"
#include "ui/views/controls/resize_area.h"
#include "ui/views/painter.h"
#include "ui/views/widget/widget.h"
......
......@@ -30,7 +30,7 @@
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/text_constants.h"
#include "ui/gfx/vector_icons_public.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_dialog_delegate.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/menu_button.h"
......
......@@ -8,7 +8,6 @@
#include "base/macros.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
......
// Copyright (c) 2012 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 "ui/views/bubble/bubble_delegate.h"
#include "build/build_config.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/default_style.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/focus/view_storage.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
#endif
namespace views {
namespace {
// Create a widget to host the bubble.
Widget* CreateBubbleWidget(BubbleDelegateView* bubble) {
Widget* bubble_widget = new Widget();
Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE);
bubble_params.delegate = bubble;
bubble_params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW;
bubble_params.accept_events = bubble->accept_events();
if (bubble->parent_window())
bubble_params.parent = bubble->parent_window();
else if (bubble->anchor_widget())
bubble_params.parent = bubble->anchor_widget()->GetNativeView();
bubble_params.activatable = bubble->CanActivate() ?
Widget::InitParams::ACTIVATABLE_YES : Widget::InitParams::ACTIVATABLE_NO;
bubble->OnBeforeBubbleWidgetInit(&bubble_params, bubble_widget);
bubble_widget->Init(bubble_params);
if (bubble_params.parent)
bubble_widget->StackAbove(bubble_params.parent);
return bubble_widget;
}
} // namespace
// static
const char BubbleDelegateView::kViewClassName[] = "BubbleDelegateView";
BubbleDelegateView::BubbleDelegateView()
: BubbleDelegateView(nullptr, BubbleBorder::TOP_LEFT) {}
BubbleDelegateView::BubbleDelegateView(View* anchor_view,
BubbleBorder::Arrow arrow)
: close_on_esc_(true),
close_on_deactivate_(true),
anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()),
anchor_widget_(NULL),
arrow_(arrow),
shadow_(BubbleBorder::SMALL_SHADOW),
color_explicitly_set_(false),
margins_(kPanelVertMargin,
kPanelHorizMargin,
kPanelVertMargin,
kPanelHorizMargin),
accept_events_(true),
border_accepts_events_(true),
adjust_if_offscreen_(true),
parent_window_(NULL),
close_reason_(CloseReason::UNKNOWN) {
if (anchor_view)
SetAnchorView(anchor_view);
AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
UpdateColorsFromTheme(GetNativeTheme());
}
BubbleDelegateView::~BubbleDelegateView() {
if (GetWidget())
GetWidget()->RemoveObserver(this);
SetLayoutManager(NULL);
SetAnchorView(NULL);
}
// static
Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) {
bubble_delegate->Init();
// Get the latest anchor widget from the anchor view at bubble creation time.
bubble_delegate->SetAnchorView(bubble_delegate->GetAnchorView());
Widget* bubble_widget = CreateBubbleWidget(bubble_delegate);
#if defined(OS_WIN)
// If glass is enabled, the bubble is allowed to extend outside the bounds of
// the parent frame and let DWM handle compositing. If not, then we don't
// want to allow the bubble to extend the frame because it will be clipped.
bubble_delegate->set_adjust_if_offscreen(ui::win::IsAeroGlassEnabled());
#elif (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX)
// Linux clips bubble windows that extend outside their parent window bounds.
// Mac never adjusts.
bubble_delegate->set_adjust_if_offscreen(false);
#endif
bubble_delegate->SizeToContents();
bubble_widget->AddObserver(bubble_delegate);
return bubble_widget;
}
BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() {
return this;
}
bool BubbleDelegateView::ShouldShowCloseButton() const {
return false;
}
View* BubbleDelegateView::GetContentsView() {
return this;
}
NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView(
Widget* widget) {
BubbleFrameView* frame = new BubbleFrameView(
gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin),
margins());
// Note: In CreateBubble, the call to SizeToContents() will cause
// the relayout that this call requires.
frame->SetTitleFontList(GetTitleFontList());
frame->SetFootnoteView(CreateFootnoteView());
BubbleBorder::Arrow adjusted_arrow = arrow();
if (base::i18n::IsRTL())
adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow);
frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>(
new BubbleBorder(adjusted_arrow, shadow(), color())));
return frame;
}
void BubbleDelegateView::GetAccessibleState(ui::AXViewState* state) {
state->role = ui::AX_ROLE_DIALOG;
}
const char* BubbleDelegateView::GetClassName() const {
return kViewClassName;
}
void BubbleDelegateView::OnWidgetClosing(Widget* widget) {
DCHECK(GetBubbleFrameView());
if (widget == GetWidget() && close_reason_ == CloseReason::UNKNOWN &&
GetBubbleFrameView()->close_button_clicked()) {
close_reason_ = CloseReason::CLOSE_BUTTON;
}
}
void BubbleDelegateView::OnWidgetDestroying(Widget* widget) {
if (anchor_widget() == widget)
SetAnchorView(NULL);
}
void BubbleDelegateView::OnWidgetVisibilityChanging(Widget* widget,
bool visible) {
#if defined(OS_WIN)
// On Windows we need to handle this before the bubble is visible or hidden.
// Please see the comment on the OnWidgetVisibilityChanging function. On
// other platforms it is fine to handle it after the bubble is shown/hidden.
HandleVisibilityChanged(widget, visible);
#endif
}
void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget,
bool visible) {
#if !defined(OS_WIN)
HandleVisibilityChanged(widget, visible);
#endif
}
void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget,
bool active) {
if (close_on_deactivate() && widget == GetWidget() && !active) {
if (close_reason_ == CloseReason::UNKNOWN)
close_reason_ = CloseReason::DEACTIVATION;
GetWidget()->Close();
}
}
void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget,
const gfx::Rect& new_bounds) {
if (GetBubbleFrameView() && anchor_widget() == widget)
SizeToContents();
}
View* BubbleDelegateView::GetAnchorView() const {
return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_);
}
gfx::Rect BubbleDelegateView::GetAnchorRect() const {
if (!GetAnchorView())
return anchor_rect_;
anchor_rect_ = GetAnchorView()->GetBoundsInScreen();
anchor_rect_.Inset(anchor_view_insets_);
return anchor_rect_;
}
void BubbleDelegateView::OnBeforeBubbleWidgetInit(Widget::InitParams* params,
Widget* widget) const {
}
View* BubbleDelegateView::CreateFootnoteView() {
return nullptr;
}
void BubbleDelegateView::UseCompactMargins() {
const int kCompactMargin = 6;
margins_.Set(kCompactMargin, kCompactMargin, kCompactMargin, kCompactMargin);
}
void BubbleDelegateView::SetAlignment(BubbleBorder::BubbleAlignment alignment) {
GetBubbleFrameView()->bubble_border()->set_alignment(alignment);
SizeToContents();
}
void BubbleDelegateView::SetArrowPaintType(
BubbleBorder::ArrowPaintType paint_type) {
GetBubbleFrameView()->bubble_border()->set_paint_arrow(paint_type);
SizeToContents();
}
void BubbleDelegateView::OnAnchorBoundsChanged() {
SizeToContents();
}
bool BubbleDelegateView::AcceleratorPressed(
const ui::Accelerator& accelerator) {
if (!close_on_esc() || accelerator.key_code() != ui::VKEY_ESCAPE)
return false;
close_reason_ = CloseReason::ESCAPE;
GetWidget()->Close();
return true;
}
void BubbleDelegateView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
UpdateColorsFromTheme(theme);
}
void BubbleDelegateView::Init() {}
void BubbleDelegateView::SetAnchorView(View* anchor_view) {
// When the anchor view gets set the associated anchor widget might
// change as well.
if (!anchor_view || anchor_widget() != anchor_view->GetWidget()) {
if (anchor_widget()) {
anchor_widget_->RemoveObserver(this);
anchor_widget_ = NULL;
}
if (anchor_view) {
anchor_widget_ = anchor_view->GetWidget();
if (anchor_widget_)
anchor_widget_->AddObserver(this);
}
}
// Remove the old storage item and set the new (if there is one).
ViewStorage* view_storage = ViewStorage::GetInstance();
if (view_storage->RetrieveView(anchor_view_storage_id_))
view_storage->RemoveView(anchor_view_storage_id_);
if (anchor_view)
view_storage->StoreView(anchor_view_storage_id_, anchor_view);
// Do not update anchoring for NULL views; this could indicate that our
// NativeWindow is being destroyed, so it would be dangerous for us to update
// our anchor bounds at that point. (It's safe to skip this, since if we were
// to update the bounds when |anchor_view| is NULL, the bubble won't move.)
if (anchor_view && GetWidget())
OnAnchorBoundsChanged();
}
void BubbleDelegateView::SetAnchorRect(const gfx::Rect& rect) {
anchor_rect_ = rect;
if (GetWidget())
OnAnchorBoundsChanged();
}
void BubbleDelegateView::SizeToContents() {
GetWidget()->SetBounds(GetBubbleBounds());
}
BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const {
const NonClientView* view =
GetWidget() ? GetWidget()->non_client_view() : NULL;
return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL;
}
gfx::Rect BubbleDelegateView::GetBubbleBounds() {
// The argument rect has its origin at the bubble's arrow anchor point;
// its size is the preferred size of the bubble's client view (this view).
bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized();
return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(),
GetPreferredSize(), adjust_if_offscreen_ && !anchor_minimized);
}
const gfx::FontList& BubbleDelegateView::GetTitleFontList() const {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
return rb.GetFontListWithDelta(ui::kTitleFontSizeDelta);
}
void BubbleDelegateView::UpdateColorsFromTheme(const ui::NativeTheme* theme) {
if (!color_explicitly_set_)
color_ = theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground);
set_background(Background::CreateSolidBackground(color()));
BubbleFrameView* frame_view = GetBubbleFrameView();
if (frame_view)
frame_view->bubble_border()->set_background_color(color());
}
void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) {
if (widget == GetWidget() && anchor_widget() &&
anchor_widget()->GetTopLevelWidget()) {
anchor_widget()->GetTopLevelWidget()->SetAlwaysRenderAsActive(visible);
}
// Fire AX_EVENT_ALERT for bubbles marked as AX_ROLE_ALERT_DIALOG; this
// instructs accessibility tools to read the bubble in its entirety rather
// than just its title and initially focused view. See
// http://crbug.com/474622 for details.
if (widget == GetWidget() && visible) {
ui::AXViewState state;
GetAccessibleState(&state);
if (state.role == ui::AX_ROLE_ALERT_DIALOG)
NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
}
}
} // namespace views
// Copyright (c) 2012 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.
#ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
#define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
#include "ui/views/widget/widget_observer.h"
namespace gfx {
class FontList;
class Rect;
}
namespace views {
class BubbleFrameView;
// BubbleDelegateView creates frame and client views for bubble Widgets.
// BubbleDelegateView itself is the client's contents view.
// TODO(estade): remove this in favor of BubbleDialogDelegateView.
class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
public WidgetObserver {
public:
// Internal class name.
static const char kViewClassName[];
enum class CloseReason {
DEACTIVATION,
ESCAPE,
CLOSE_BUTTON,
UNKNOWN,
};
BubbleDelegateView();
BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow);
~BubbleDelegateView() override;
// Create and initialize the bubble Widget(s) with proper bounds.
static Widget* CreateBubble(BubbleDelegateView* bubble_delegate);
// WidgetDelegateView overrides:
BubbleDelegateView* AsBubbleDelegate() override;
bool ShouldShowCloseButton() const override;
View* GetContentsView() override;
NonClientFrameView* CreateNonClientFrameView(Widget* widget) override;
void GetAccessibleState(ui::AXViewState* state) override;
const char* GetClassName() const override;
// WidgetObserver overrides:
void OnWidgetClosing(Widget* widget) override;
void OnWidgetDestroying(Widget* widget) override;
void OnWidgetVisibilityChanging(Widget* widget, bool visible) override;
void OnWidgetVisibilityChanged(Widget* widget, bool visible) override;
void OnWidgetActivationChanged(Widget* widget, bool active) override;
void OnWidgetBoundsChanged(Widget* widget,
const gfx::Rect& new_bounds) override;
bool close_on_esc() const { return close_on_esc_; }
void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
bool close_on_deactivate() const { return close_on_deactivate_; }
void set_close_on_deactivate(bool close) { close_on_deactivate_ = close; }
View* GetAnchorView() const;
Widget* anchor_widget() const { return anchor_widget_; }
// The anchor rect is used in the absence of an assigned anchor view.
const gfx::Rect& anchor_rect() const { return anchor_rect_; }
BubbleBorder::Arrow arrow() const { return arrow_; }
void set_arrow(BubbleBorder::Arrow arrow) { arrow_ = arrow; }
BubbleBorder::Shadow shadow() const { return shadow_; }
void set_shadow(BubbleBorder::Shadow shadow) { shadow_ = shadow; }
SkColor color() const { return color_; }
void set_color(SkColor color) {
color_ = color;
color_explicitly_set_ = true;
}
const gfx::Insets& margins() const { return margins_; }
void set_margins(const gfx::Insets& margins) { margins_ = margins; }
const gfx::Insets& anchor_view_insets() const { return anchor_view_insets_; }
void set_anchor_view_insets(const gfx::Insets& i) { anchor_view_insets_ = i; }
gfx::NativeView parent_window() const { return parent_window_; }
void set_parent_window(gfx::NativeView window) { parent_window_ = window; }
bool accept_events() const { return accept_events_; }
void set_accept_events(bool accept_events) { accept_events_ = accept_events; }
bool border_accepts_events() const { return border_accepts_events_; }
void set_border_accepts_events(bool event) { border_accepts_events_ = event; }
bool adjust_if_offscreen() const { return adjust_if_offscreen_; }
void set_adjust_if_offscreen(bool adjust) { adjust_if_offscreen_ = adjust; }
CloseReason close_reason() const { return close_reason_; }
// Get the arrow's anchor rect in screen space.
virtual gfx::Rect GetAnchorRect() const;
// Allows delegates to provide custom parameters before widget initialization.
virtual void OnBeforeBubbleWidgetInit(Widget::InitParams* params,
Widget* widget) const;
// Creates and returns a view to be displayed at the bottom of the bubble.
virtual View* CreateFootnoteView();
// Sets |margins_| to a default picked for smaller bubbles.
void UseCompactMargins();
// Sets the bubble alignment relative to the anchor. This may only be called
// after calling CreateBubble.
void SetAlignment(BubbleBorder::BubbleAlignment alignment);
// Sets the bubble arrow paint type.
void SetArrowPaintType(BubbleBorder::ArrowPaintType paint_type);
// Call this method when the anchor bounds have changed to reposition the
// bubble. The bubble is automatically repositioned when the anchor view
// bounds change as a result of the widget's bounds changing.
void OnAnchorBoundsChanged();
protected:
// Get bubble bounds from the anchor rect and client view's preferred size.
virtual gfx::Rect GetBubbleBounds();
// Return a FontList to use for the title of the bubble.
// (The default is MediumFont).
virtual const gfx::FontList& GetTitleFontList() const;
// View overrides:
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
// Perform view initialization on the contents for bubble sizing.
virtual void Init();
// Sets the anchor view or rect and repositions the bubble. Note that if a
// valid view gets passed, the anchor rect will get ignored. If the view gets
// deleted, but no new view gets set, the last known anchor postion will get
// returned.
void SetAnchorView(View* anchor_view);
void SetAnchorRect(const gfx::Rect& rect);
// Resize and potentially move the bubble to fit the content's preferred size.
void SizeToContents();
BubbleFrameView* GetBubbleFrameView() const;
private:
friend class BubbleBorderDelegate;
friend class BubbleWindowTargeter;
FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate);
FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, NonClientHitTest);
// Update the bubble color from |theme|, unless it was explicitly set.
void UpdateColorsFromTheme(const ui::NativeTheme* theme);
// Handles widget visibility changes.
void HandleVisibilityChanged(Widget* widget, bool visible);
// Flags controlling bubble closure on the escape key and deactivation.
bool close_on_esc_;
bool close_on_deactivate_;
// The view and widget to which this bubble is anchored. Since an anchor view
// can be deleted without notice, we store it in the ViewStorage and retrieve
// it from there. It will make sure that the view is still valid.
const int anchor_view_storage_id_;
Widget* anchor_widget_;
// The anchor rect used in the absence of an anchor view.
mutable gfx::Rect anchor_rect_;
// The arrow's location on the bubble.
BubbleBorder::Arrow arrow_;
// Bubble border shadow to use.
BubbleBorder::Shadow shadow_;
// The background color of the bubble; and flag for when it's explicitly set.
SkColor color_;
bool color_explicitly_set_;
// The margins between the content and the inside of the border.
gfx::Insets margins_;
// Insets applied to the |anchor_view_| bounds.
gfx::Insets anchor_view_insets_;
// Specifies whether the bubble (or its border) handles mouse events, etc.
bool accept_events_;
bool border_accepts_events_;
// If true (defaults to true), the arrow may be mirrored and moved to fit the
// bubble on screen better. It would be a no-op if the bubble has no arrow.
bool adjust_if_offscreen_;
// Parent native window of the bubble.
gfx::NativeView parent_window_;
CloseReason close_reason_;
DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
};
} // namespace views
#endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
// Copyright (c) 2012 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 <stddef.h>
#include "base/macros.h"
#include "ui/base/hit_test.h"
#include "ui/events/event_utils.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/test/test_widget_observer.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
namespace views {
namespace {
class TestBubbleDelegateView : public BubbleDelegateView {
public:
TestBubbleDelegateView(View* anchor_view)
: BubbleDelegateView(anchor_view, BubbleBorder::TOP_LEFT),
view_(new View()) {
view_->SetFocusable(true);
AddChildView(view_);
}
~TestBubbleDelegateView() override {}
void SetAnchorRectForTest(gfx::Rect rect) {
SetAnchorRect(rect);
}
void SetAnchorViewForTest(View* view) {
SetAnchorView(view);
}
// BubbleDelegateView overrides:
View* GetInitiallyFocusedView() override { return view_; }
gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); }
BubbleFrameView* GetBubbleFrameViewForTest() const {
return GetBubbleFrameView();
}
private:
View* view_;
DISALLOW_COPY_AND_ASSIGN(TestBubbleDelegateView);
};
class BubbleDelegateTest : public ViewsTestBase {
public:
BubbleDelegateTest() {}
~BubbleDelegateTest() override {}
// Creates a test widget that owns its native widget.
Widget* CreateTestWidget() {
Widget* widget = new Widget();
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget->Init(params);
return widget;
}
private:
DISALLOW_COPY_AND_ASSIGN(BubbleDelegateTest);
};
} // namespace
TEST_F(BubbleDelegateTest, CreateDelegate) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
bubble_delegate->set_color(SK_ColorGREEN);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
EXPECT_EQ(bubble_delegate, bubble_widget->widget_delegate());
EXPECT_EQ(bubble_widget, bubble_delegate->GetWidget());
test::TestWidgetObserver bubble_observer(bubble_widget);
bubble_widget->Show();
BubbleBorder* border = bubble_delegate->GetBubbleFrameView()->bubble_border();
EXPECT_EQ(bubble_delegate->arrow(), border->arrow());
EXPECT_EQ(bubble_delegate->color(), border->background_color());
EXPECT_FALSE(bubble_observer.widget_closed());
bubble_widget->CloseNow();
EXPECT_TRUE(bubble_observer.widget_closed());
}
TEST_F(BubbleDelegateTest, CloseAnchorWidget) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
// Preventing close on deactivate should not prevent closing with the anchor.
bubble_delegate->set_close_on_deactivate(false);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
EXPECT_EQ(bubble_delegate, bubble_widget->widget_delegate());
EXPECT_EQ(bubble_widget, bubble_delegate->GetWidget());
EXPECT_EQ(anchor_widget.get(), bubble_delegate->anchor_widget());
test::TestWidgetObserver bubble_observer(bubble_widget);
EXPECT_FALSE(bubble_observer.widget_closed());
bubble_widget->Show();
EXPECT_EQ(anchor_widget.get(), bubble_delegate->anchor_widget());
EXPECT_FALSE(bubble_observer.widget_closed());
// TODO(msw): Remove activation hack to prevent bookkeeping errors in:
// aura::test::TestActivationClient::OnWindowDestroyed().
std::unique_ptr<Widget> smoke_and_mirrors_widget(CreateTestWidget());
EXPECT_FALSE(bubble_observer.widget_closed());
// Ensure that closing the anchor widget also closes the bubble itself.
anchor_widget->CloseNow();
EXPECT_TRUE(bubble_observer.widget_closed());
}
// This test checks that the bubble delegate is capable to handle an early
// destruction of the used anchor view. (Animations and delayed closure of the
// bubble will call upon the anchor view to get its location).
TEST_F(BubbleDelegateTest, CloseAnchorViewTest) {
// Create an anchor widget and add a view to be used as an anchor view.
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
std::unique_ptr<View> anchor_view(new View());
anchor_widget->GetContentsView()->AddChildView(anchor_view.get());
TestBubbleDelegateView* bubble_delegate = new TestBubbleDelegateView(
anchor_view.get());
// Prevent flakes by avoiding closing on activation changes.
bubble_delegate->set_close_on_deactivate(false);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
// Check that the anchor view is correct and set up an anchor view rect.
// Make sure that this rect will get ignored (as long as the anchor view is
// attached).
EXPECT_EQ(anchor_view.get(), bubble_delegate->GetAnchorView());
const gfx::Rect set_anchor_rect = gfx::Rect(10, 10, 100, 100);
bubble_delegate->SetAnchorRectForTest(set_anchor_rect);
const gfx::Rect view_rect = bubble_delegate->GetAnchorRect();
EXPECT_NE(view_rect.ToString(), set_anchor_rect.ToString());
// Create the bubble.
bubble_widget->Show();
EXPECT_EQ(anchor_widget.get(), bubble_delegate->anchor_widget());
// Remove now the anchor view and make sure that the original found rect
// is still kept, so that the bubble does not jump when the view gets deleted.
anchor_widget->GetContentsView()->RemoveChildView(anchor_view.get());
anchor_view.reset();
EXPECT_EQ(NULL, bubble_delegate->GetAnchorView());
EXPECT_EQ(view_rect.ToString(), bubble_delegate->GetAnchorRect().ToString());
}
// Testing that a move of the anchor view will lead to new bubble locations.
TEST_F(BubbleDelegateTest, TestAnchorRectMovesWithViewTest) {
// Create an anchor widget and add a view to be used as anchor view.
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
TestBubbleDelegateView* bubble_delegate = new TestBubbleDelegateView(
anchor_widget->GetContentsView());
BubbleDelegateView::CreateBubble(bubble_delegate);
anchor_widget->GetContentsView()->SetBounds(10, 10, 100, 100);
const gfx::Rect view_rect = bubble_delegate->GetAnchorRect();
anchor_widget->GetContentsView()->SetBounds(20, 10, 100, 100);
const gfx::Rect view_rect_2 = bubble_delegate->GetAnchorRect();
EXPECT_NE(view_rect.ToString(), view_rect_2.ToString());
}
TEST_F(BubbleDelegateTest, ResetAnchorWidget) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
// Make sure the bubble widget is parented to a widget other than the anchor
// widget so that closing the anchor widget does not close the bubble widget.
std::unique_ptr<Widget> parent_widget(CreateTestWidget());
bubble_delegate->set_parent_window(parent_widget->GetNativeView());
// Preventing close on deactivate should not prevent closing with the parent.
bubble_delegate->set_close_on_deactivate(false);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
EXPECT_EQ(bubble_delegate, bubble_widget->widget_delegate());
EXPECT_EQ(bubble_widget, bubble_delegate->GetWidget());
EXPECT_EQ(anchor_widget.get(), bubble_delegate->anchor_widget());
test::TestWidgetObserver bubble_observer(bubble_widget);
EXPECT_FALSE(bubble_observer.widget_closed());
// Showing and hiding the bubble widget should have no effect on its anchor.
bubble_widget->Show();
EXPECT_EQ(anchor_widget.get(), bubble_delegate->anchor_widget());
bubble_widget->Hide();
EXPECT_EQ(anchor_widget.get(), bubble_delegate->anchor_widget());
// Ensure that closing the anchor widget clears the bubble's reference to that
// anchor widget, but the bubble itself does not close.
anchor_widget->CloseNow();
EXPECT_NE(anchor_widget.get(), bubble_delegate->anchor_widget());
EXPECT_FALSE(bubble_observer.widget_closed());
// TODO(msw): Remove activation hack to prevent bookkeeping errors in:
// aura::test::TestActivationClient::OnWindowDestroyed().
std::unique_ptr<Widget> smoke_and_mirrors_widget(CreateTestWidget());
EXPECT_FALSE(bubble_observer.widget_closed());
// Ensure that closing the parent widget also closes the bubble itself.
parent_widget->CloseNow();
EXPECT_TRUE(bubble_observer.widget_closed());
}
TEST_F(BubbleDelegateTest, InitiallyFocusedView) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
EXPECT_EQ(bubble_delegate->GetInitiallyFocusedView(),
bubble_widget->GetFocusManager()->GetFocusedView());
bubble_widget->CloseNow();
}
TEST_F(BubbleDelegateTest, NonClientHitTest) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
TestBubbleDelegateView* bubble_delegate =
new TestBubbleDelegateView(anchor_widget->GetContentsView());
BubbleDelegateView::CreateBubble(bubble_delegate);
BubbleFrameView* frame = bubble_delegate->GetBubbleFrameView();
const int border = frame->bubble_border()->GetBorderThickness();
struct {
const int point;
const int hit;
} cases[] = {
{ border, HTNOWHERE },
{ border + 50, HTCLIENT },
{ 1000, HTNOWHERE },
};
for (size_t i = 0; i < arraysize(cases); ++i) {
gfx::Point point(cases[i].point, cases[i].point);
EXPECT_EQ(cases[i].hit, frame->NonClientHitTest(point))
<< " with border: " << border << ", at point " << cases[i].point;
}
}
TEST_F(BubbleDelegateTest, VisibleWhenAnchorWidgetBoundsChanged) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
test::TestWidgetObserver bubble_observer(bubble_widget);
EXPECT_FALSE(bubble_observer.widget_closed());
anchor_widget->Show();
bubble_widget->Show();
EXPECT_TRUE(bubble_widget->IsVisible());
anchor_widget->SetBounds(gfx::Rect(10, 10, 100, 100));
EXPECT_TRUE(bubble_widget->IsVisible());
}
// Test that setting WidgetDelegate::set_can_activate() to false makes the
// widget created via BubbleDelegateView::CreateBubble() not activatable.
TEST_F(BubbleDelegateTest, NotActivatable) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
bubble_delegate->set_can_activate(false);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
bubble_widget->Show();
EXPECT_FALSE(bubble_widget->CanActivate());
}
TEST_F(BubbleDelegateTest, CloseReasons) {
{
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
bubble_delegate->set_close_on_deactivate(true);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
anchor_widget->Show();
bubble_widget->Show();
anchor_widget->Activate();
EXPECT_TRUE(bubble_widget->IsClosed());
EXPECT_EQ(BubbleDelegateView::CloseReason::DEACTIVATION,
bubble_delegate->close_reason());
}
{
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
anchor_widget->GetContentsView(), BubbleBorder::NONE);
bubble_delegate->set_close_on_esc(true);
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
bubble_widget->Show();
// Cast as a test hack to access AcceleratorPressed() (which is protected
// in BubbleDelegate).
static_cast<View*>(bubble_delegate)
->AcceleratorPressed(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
EXPECT_TRUE(bubble_widget->IsClosed());
EXPECT_EQ(BubbleDelegateView::CloseReason::ESCAPE,
bubble_delegate->close_reason());
}
{
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
TestBubbleDelegateView* bubble_delegate =
new TestBubbleDelegateView(anchor_widget->GetContentsView());
Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
bubble_widget->Show();
BubbleFrameView* frame_view = bubble_delegate->GetBubbleFrameViewForTest();
LabelButton* close_button = frame_view->close_;
ASSERT_TRUE(close_button);
frame_view->ButtonPressed(
close_button,
ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0),
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE));
EXPECT_TRUE(bubble_widget->IsClosed());
EXPECT_EQ(BubbleDelegateView::CloseReason::CLOSE_BUTTON,
bubble_delegate->close_reason());
}
}
} // namespace views
......@@ -48,8 +48,6 @@
'border.h',
'bubble/bubble_border.cc',
'bubble/bubble_border.h',
'bubble/bubble_delegate.cc',
'bubble/bubble_delegate.h',
'bubble/bubble_dialog_delegate.cc',
'bubble/bubble_dialog_delegate.h',
'bubble/bubble_frame_view.cc',
......@@ -568,7 +566,6 @@
'animation/ink_drop_hover_unittest.cc',
'animation/square_ink_drop_animation_unittest.cc',
'bubble/bubble_border_unittest.cc',
'bubble/bubble_delegate_unittest.cc',
'bubble/bubble_dialog_delegate_unittest.cc',
'bubble/bubble_frame_view_unittest.cc',
'bubble/bubble_window_targeter_unittest.cc',
......
......@@ -6,7 +6,6 @@
#include "base/strings/utf_string_conversions.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/view.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/widget.h"
......@@ -35,10 +34,6 @@ View* WidgetDelegate::GetInitiallyFocusedView() {
return nullptr;
}
BubbleDelegateView* WidgetDelegate::AsBubbleDelegate() {
return nullptr;
}
BubbleDialogDelegateView* WidgetDelegate::AsBubbleDialogDelegate() {
return nullptr;
}
......
......@@ -20,7 +20,6 @@ class Rect;
namespace views {
class BubbleDialogDelegateView;
class BubbleDelegateView;
class ClientView;
class DialogDelegate;
class NonClientFrameView;
......@@ -51,7 +50,6 @@ class VIEWS_EXPORT WidgetDelegate {
// NULL no view is focused.
virtual View* GetInitiallyFocusedView();
virtual BubbleDelegateView* AsBubbleDelegate();
virtual BubbleDialogDelegateView* AsBubbleDialogDelegate();
virtual DialogDelegate* AsDialogDelegate();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment