summaryrefslogtreecommitdiffstats
path: root/views/bubble
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-09 02:23:05 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-09 02:23:05 +0000
commit575fdd3b09c42c0a25fe2a7c3e7b6b94dd78e95a (patch)
tree319a3c2bb9847faaa7bc1f4cc28b333e5924e3fb /views/bubble
parentce66597472a5f1527f76a5e25f2333bf4a995824 (diff)
downloadchromium_src-575fdd3b09c42c0a25fe2a7c3e7b6b94dd78e95a.zip
chromium_src-575fdd3b09c42c0a25fe2a7c3e7b6b94dd78e95a.tar.gz
chromium_src-575fdd3b09c42c0a25fe2a7c3e7b6b94dd78e95a.tar.bz2
Revert 100231 - memory bot failures
r100231 was: add bubble views files. BUG=none TEST=none Review URL: http://codereview.chromium.org/7720001 TBR=alicet@chromium.org Review URL: http://codereview.chromium.org/7860025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/bubble')
-rw-r--r--views/bubble/bubble_delegate.cc66
-rw-r--r--views/bubble/bubble_delegate.h63
-rw-r--r--views/bubble/bubble_delegate_unittest.cc41
-rw-r--r--views/bubble/bubble_frame_view.cc73
-rw-r--r--views/bubble/bubble_frame_view.h65
-rw-r--r--views/bubble/bubble_frame_view_unittest.cc67
-rw-r--r--views/bubble/bubble_view.cc128
-rw-r--r--views/bubble/bubble_view.h87
-rw-r--r--views/bubble/bubble_view_unittest.cc80
9 files changed, 0 insertions, 670 deletions
diff --git a/views/bubble/bubble_delegate.cc b/views/bubble/bubble_delegate.cc
deleted file mode 100644
index 14a06e8..0000000
--- a/views/bubble/bubble_delegate.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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
diff --git a/views/bubble/bubble_delegate.h b/views/bubble/bubble_delegate.h
deleted file mode 100644
index 32cf0a4..0000000
--- a/views/bubble/bubble_delegate.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.
-
-#ifndef VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
-#define VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
-#pragma once
-
-#include <string>
-
-#include "views/bubble/bubble_border.h"
-#include "views/view.h"
-#include "views/widget/widget_delegate.h"
-
-namespace views {
-class BubbleBorder;
-class BubbleFrameView;
-class BubbleView;
-class View;
-
-// BubbleDelegate interface to create bubble frame view and bubble client view.
-//
-///////////////////////////////////////////////////////////////////////////////
-class VIEWS_EXPORT BubbleDelegate : public WidgetDelegate {
- public:
- virtual BubbleDelegate* AsBubbleDelegate() OVERRIDE;
- virtual ClientView* CreateClientView(Widget* widget) OVERRIDE;
- virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
-
- virtual SkColor GetFrameBackgroundColor() = 0;
- virtual gfx::Rect GetBounds() = 0;
- virtual BubbleBorder::ArrowLocation GetFrameArrowLocation() = 0;
-
- const BubbleView* GetBubbleView() const;
- BubbleView* GetBubbleView();
-
- const BubbleFrameView* GetBubbleFrameView() const;
- BubbleFrameView* GetBubbleFrameView();
-
- protected:
- virtual ~BubbleDelegate() {}
-};
-
-// BubbleDelegateView to create bubble frame view and bubble client view.
-//
-///////////////////////////////////////////////////////////////////////////////
-class VIEWS_EXPORT BubbleDelegateView : public BubbleDelegate, public View {
- public:
- explicit BubbleDelegateView(Widget* frame);
- virtual ~BubbleDelegateView();
-
- // Overridden from WidgetDelegate:
- virtual Widget* GetWidget() OVERRIDE;
- virtual const Widget* GetWidget() const OVERRIDE;
-
- private:
- Widget* frame_;
- DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
-};
-
-} // namespace views
-
-#endif // VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
diff --git a/views/bubble/bubble_delegate_unittest.cc b/views/bubble/bubble_delegate_unittest.cc
deleted file mode 100644
index cd2db9a..0000000
--- a/views/bubble/bubble_delegate_unittest.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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 "base/message_loop.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/base/animation/slide_animation.h"
-#include "views/bubble/bubble_border.h"
-#include "views/bubble/bubble_delegate.h"
-#include "views/bubble/bubble_view.h"
-#include "views/widget/widget.h"
-
-namespace views {
-
-namespace {
-
-class TestBubbleDelegate : public BubbleDelegateView {
- public:
- explicit TestBubbleDelegate(Widget *frame): BubbleDelegateView(frame) {}
- SkColor GetFrameBackgroundColor() { return SK_ColorGREEN; }
- gfx::Rect GetBounds() { return gfx::Rect(10, 10, 200, 200); }
- BubbleBorder::ArrowLocation GetFrameArrowLocation() {
- return BubbleBorder::LEFT_BOTTOM;
- }
-};
-
-TEST(BubbleDelegateTest, CreateDelegate) {
- MessageLoopForUI message_loop;
- Widget* bubble_widget = new Widget();
- Widget::InitParams params(Widget::InitParams::TYPE_BUBBLE);
- TestBubbleDelegate* delegate = new TestBubbleDelegate(bubble_widget);
- params.delegate = delegate;
- bubble_widget->Init(params);
- EXPECT_EQ(delegate, bubble_widget->widget_delegate());
- EXPECT_EQ(bubble_widget, delegate->GetWidget());
- MessageLoop::current()->RunAllPending();
-}
-
-} // namespace
-} // namespace views
diff --git a/views/bubble/bubble_frame_view.cc b/views/bubble/bubble_frame_view.cc
deleted file mode 100644
index b3c2f70..0000000
--- a/views/bubble/bubble_frame_view.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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_frame_view.h"
-
-#include "grit/ui_resources.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/path.h"
-#include "views/bubble/bubble_border.h"
-#include "views/widget/widget_delegate.h"
-#include "views/window/client_view.h"
-
-namespace views {
-
-BubbleFrameView::BubbleFrameView(Widget* frame,
- const gfx::Rect& bounds,
- SkColor color,
- BubbleBorder::ArrowLocation location)
- : frame_(frame),
- frame_bounds_(bounds),
- bubble_border_(new BubbleBorder(location)),
- bubble_background_(new BubbleBackground(bubble_border_)) {
- SetBoundsRect(bounds);
- bubble_border_->set_background_color(color);
- set_border(bubble_border_);
- set_background(bubble_background_);
-}
-
-BubbleFrameView::~BubbleFrameView() {}
-
-gfx::Rect BubbleFrameView::GetBoundsForClientView() const {
- gfx::Insets insets;
- bubble_border_->GetInsets(&insets);
- return gfx::Rect(insets.left(), insets.top(),
- frame_bounds_.width() - insets.left() - insets.right(),
- frame_bounds_.height() - insets.top() - insets.bottom());
-}
-
-gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const {
- return bubble_border_->GetBounds(client_bounds, client_bounds.size());
-}
-
-void BubbleFrameView::EnableClose(bool enable) {
-}
-
-void BubbleFrameView::ResetWindowControls() {
-}
-
-void BubbleFrameView::UpdateWindowIcon() {
-}
-
-void BubbleFrameView::OnPaint(gfx::Canvas* canvas) {
- border()->Paint(*this, canvas);
- bubble_background_->Paint(canvas, this);
-}
-
-int BubbleFrameView::NonClientHitTest(const gfx::Point& point) {
- return frame_->client_view()->NonClientHitTest(point);
-}
-
-void BubbleFrameView::GetWindowMask(const gfx::Size& size,
- gfx::Path* window_mask) {
-}
-
-gfx::Size BubbleFrameView::GetPreferredSize() {
- gfx::Size pref = frame_->client_view()->GetPreferredSize();
- gfx::Rect bounds(0, 0, pref.width(), pref.height());
- return frame_->non_client_view()->GetWindowBoundsForClientBounds(
- bounds).size();
-}
-} // namespace views
diff --git a/views/bubble/bubble_frame_view.h b/views/bubble/bubble_frame_view.h
deleted file mode 100644
index c6ec085..0000000
--- a/views/bubble/bubble_frame_view.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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.
-
-#ifndef VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
-#define VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
-#pragma once
-
-#include "views/bubble/bubble_border.h"
-#include "views/widget/widget.h"
-#include "views/window/client_view.h"
-#include "views/window/window_resources.h"
-
-namespace gfx {
-class Canvas;
-class Font;
-class Size;
-class Path;
-class Point;
-}
-
-namespace views {
-
-// BubbleFrameView to render BubbleBorder.
-//
-////////////////////////////////////////////////////////////////////////////////
-class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView {
- public:
- BubbleFrameView(Widget* frame,
- const gfx::Rect& bounds,
- SkColor color,
- BubbleBorder::ArrowLocation location);
- virtual ~BubbleFrameView();
-
- // NonClientFrameView overrides:
- virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
- virtual gfx::Rect GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const OVERRIDE;
- virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
- virtual void GetWindowMask(
- const gfx::Size& size, gfx::Path* window_mask) OVERRIDE;
- virtual void EnableClose(bool enable) OVERRIDE;
- virtual void ResetWindowControls() OVERRIDE;
- virtual void UpdateWindowIcon() OVERRIDE;
-
- // View overrides:
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
- virtual gfx::Size GetPreferredSize() OVERRIDE;
-
- private:
- // Not owned.
- Widget* frame_;
- // Window bounds in screen coordinates.
- gfx::Rect frame_bounds_;
- // The bubble border object owned by this view.
- BubbleBorder* bubble_border_;
- // The bubble background object owned by this view.
- BubbleBackground* bubble_background_;
-
- DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
-};
-
-} // namespace views
-
-#endif // VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
diff --git a/views/bubble/bubble_frame_view_unittest.cc b/views/bubble/bubble_frame_view_unittest.cc
deleted file mode 100644
index 65a9e6c..0000000
--- a/views/bubble/bubble_frame_view_unittest.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// 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 "base/message_loop.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "views/bubble/bubble_border.h"
-#include "views/bubble/bubble_frame_view.h"
-#include "views/bubble/bubble_delegate.h"
-#include "views/widget/widget.h"
-#if !defined(OS_WIN)
-#include "views/window/hit_test.h"
-#endif
-namespace views {
-
-namespace {
-
-gfx::Rect kBound = gfx::Rect(10, 10, 200, 200);
-SkColor kBackgroundColor = SK_ColorRED;
-BubbleBorder::ArrowLocation kArrow = BubbleBorder::LEFT_BOTTOM;
-
-TEST(BubbleFrameViewBasicTest, GetBoundsForClientView) {
- MessageLoopForUI message_loop;
- views::Widget* widget = new views::Widget();
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_BUBBLE);
- widget->Init(params);
- BubbleFrameView frame(widget, kBound, kBackgroundColor, kArrow);
- EXPECT_EQ(kBound, frame.bounds());
- EXPECT_EQ(kArrow,
- static_cast<BubbleBorder*>(frame.border())->arrow_location());
- EXPECT_EQ(kBackgroundColor,
- static_cast<BubbleBorder*>(frame.border())->background_color());
-
- BubbleBorder* expected_border = new BubbleBorder(BubbleBorder::LEFT_BOTTOM);
- gfx::Insets expected_insets;
- expected_border->GetInsets(&expected_insets);
- EXPECT_EQ(frame.GetBoundsForClientView().x(), expected_insets.left());
- EXPECT_EQ(frame.GetBoundsForClientView().y(), expected_insets.top());
- MessageLoop::current()->RunAllPending();
-}
-
-class TestBubbleDelegate : public BubbleDelegateView {
- public:
- explicit TestBubbleDelegate(Widget *frame): BubbleDelegateView(frame) {}
- SkColor GetFrameBackgroundColor() { return kBackgroundColor; }
- gfx::Rect GetBounds() { return gfx::Rect(10, 10, 200, 200); }
- BubbleBorder::ArrowLocation GetFrameArrowLocation() { return kArrow; }
-};
-
-TEST(BubbleFrameViewBasicTest, NonClientHitTest) {
- MessageLoopForUI message_loop;
- views::Widget* widget = new views::Widget();
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_BUBBLE);
- TestBubbleDelegate* delegate = new TestBubbleDelegate(widget);
- params.delegate = delegate;
- widget->Init(params);
- gfx::Point kPtInBound(100, 100);
- gfx::Point kPtOutsideBound(1000, 1000);
- EXPECT_EQ(HTCLIENT, widget->non_client_view()->NonClientHitTest(kPtInBound));
- EXPECT_EQ(HTNOWHERE,
- widget->non_client_view()->NonClientHitTest(kPtOutsideBound));
- MessageLoop::current()->RunAllPending();
-}
-
-} // namespace
-} // namespace views
diff --git a/views/bubble/bubble_view.cc b/views/bubble/bubble_view.cc
deleted file mode 100644
index 5397f6e..0000000
--- a/views/bubble/bubble_view.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// 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_view.h"
-
-#include "ui/base/animation/slide_animation.h"
-#include "views/bubble/bubble_border.h"
-#include "views/controls/label.h"
-#include "views/layout/box_layout.h"
-#include "views/layout/layout_constants.h"
-#include "views/views_delegate.h"
-#include "views/window/client_view.h"
-#if defined(OS_WIN)
-#include "views/widget/native_widget_win.h"
-#else
-#include "views/widget/native_widget_gtk.h"
-#endif
-#include "views/widget/widget.h"
-
-// How long the fade should last for.
-static const int kHideFadeDurationMS = 1000;
-
-namespace views {
-
-BubbleView::BubbleView(Widget* owner, View* contents_view)
- : ClientView(owner, contents_view),
- animation_delegate_(NULL),
- registered_accelerator_(false),
- should_fade_(false) {
- ResetLayoutManager();
- InitAnimation();
-}
-
-void BubbleView::InitAnimation() {
- fade_animation_.reset(new ui::SlideAnimation(this));
- fade_animation_->SetSlideDuration(kHideFadeDurationMS);
- fade_animation_->Reset(1.0);
-}
-
-BubbleView* BubbleView::AsBubbleView() { return this; }
-const BubbleView* BubbleView::AsBubbleView() const { return this; }
-
-BubbleView::~BubbleView() {}
-
-void BubbleView::Show() {
- if (!registered_accelerator_)
- registered_accelerator_ = true;
- GetWidget()->Show();
- GetWidget()->Activate();
- SchedulePaint();
-}
-
-void BubbleView::StartFade() {
- should_fade_ = true;
- fade_animation_->Hide();
-}
-
-void BubbleView::ResetLayoutManager() {
- SetLayoutManager(new views::BoxLayout(
- views::BoxLayout::kHorizontal, 0, 0, 1));
-}
-
-void BubbleView::set_animation_delegate(ui::AnimationDelegate* delegate) {
- animation_delegate_ = delegate;
-}
-
-void BubbleView::ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child) {
- if (is_add && parent == this)
- child->SetBoundsRect(bounds());
-}
-
-void BubbleView::Layout() {
- gfx::Rect lb = GetContentsBounds();
- contents_view()->SetBoundsRect(lb);
- contents_view()->Layout();
-}
-
-gfx::Size BubbleView::GetPreferredSize() {
- return bounds().size();
-}
-
-bool BubbleView::AcceleratorPressed(const Accelerator& accelerator) {
- if (registered_accelerator_) {
- GetWidget()->GetFocusManager()->UnregisterAccelerator(
- views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this);
- registered_accelerator_ = false;
- }
- // Turn off animation, if any.
- if (should_fade_ && fade_animation_->is_animating()) {
- fade_animation_->Reset(1.0);
- fade_animation_->Show();
- }
- GetWidget()->Close();
- return true;
-}
-
-void BubbleView::AnimationEnded(const ui::Animation* animation) {
- if (animation_delegate_)
- animation_delegate_->AnimationEnded(animation);
-
- fade_animation_->Reset(0.0);
- // Close the widget.
- registered_accelerator_ = false;
- GetWidget()->Close();
-}
-
-void BubbleView::AnimationProgressed(const ui::Animation* animation) {
- if (fade_animation_->is_animating()) {
- if (animation_delegate_)
- animation_delegate_->AnimationProgressed(animation);
-
- SkColor opacity = static_cast<SkColor>(
- animation->GetCurrentValue() * 255);
-#if defined(OS_WIN)
- SetLayeredWindowAttributes(GetWidget()->GetNativeView(), 0,
- static_cast<byte>(opacity), LWA_ALPHA);
-#else
- static_cast<NativeWidgetGtk*>(GetWidget()->native_widget())->SetOpacity(
- opacity);
-#endif
- SchedulePaint();
- }
-}
-
-} // namespace views
diff --git a/views/bubble/bubble_view.h b/views/bubble/bubble_view.h
deleted file mode 100644
index 53fdabf..0000000
--- a/views/bubble/bubble_view.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// 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.
-
-#ifndef VIEWS_BUBBLE_BUBBLE_VIEW_H_
-#define VIEWS_BUBBLE_BUBBLE_VIEW_H_
-#pragma once
-
-#include <string>
-
-#include "base/gtest_prod_util.h"
-#include "base/task.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "views/accelerator.h"
-#include "views/focus/focus_manager.h"
-#include "views/view.h"
-#include "views/window/client_view.h"
-
-namespace ui {
-class SlideAnimation;
-} // namespace ui
-
-namespace views {
-
-// To show a bubble:
-// - Call Show() explicitly. This will not start a fading animation.
-// - Call StartFade() this starts a fading out sequence that will be
-// cut short on VKEY_ESCAPE.
-class VIEWS_EXPORT BubbleView : public ClientView,
- public ui::AnimationDelegate {
- public:
- BubbleView(Widget* widget, View* contents_view);
- virtual ~BubbleView();
-
- // Starts a fade (out) animation. Unless this method is called, bubble will
- // stay until ui::VKEY_ESCAPE is sent.
- void StartFade();
-
- // Shows the bubble.
- void Show();
-
- void set_animation_delegate(ui::AnimationDelegate* delegate);
-
- virtual BubbleView* AsBubbleView() OVERRIDE;
- virtual const BubbleView* AsBubbleView() const OVERRIDE;
-
- protected:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child) OVERRIDE;
-
- virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE;
- virtual void Layout() OVERRIDE;
- virtual gfx::Size GetPreferredSize() OVERRIDE;
-
- private:
- FRIEND_TEST(BubbleViewTest, FadeAnimation);
-
- void InitAnimation();
-
- // Sets up the layout manager based on currently initialized views. Should be
- // called when a view is initialized or changed.
- void ResetLayoutManager();
-
- // Close bubble when animation ended.
- virtual void AnimationEnded(const ui::Animation* animation);
-
- // notify on animation progress.
- virtual void AnimationProgressed(const ui::Animation* animation);
-
- // Fade animation for bubble.
- scoped_ptr<ui::SlideAnimation> fade_animation_;
-
- // Not owned.
- ui::AnimationDelegate* animation_delegate_;
-
- bool registered_accelerator_;
-
- bool should_fade_;
-
- DISALLOW_COPY_AND_ASSIGN(BubbleView);
-};
-
-} // namespace views
-
-#endif // VIEWS_BUBBLE_BUBBLE_VIEW_H_
diff --git a/views/bubble/bubble_view_unittest.cc b/views/bubble/bubble_view_unittest.cc
deleted file mode 100644
index e671c0f..0000000
--- a/views/bubble/bubble_view_unittest.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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 "base/message_loop.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/base/animation/slide_animation.h"
-#include "views/bubble/bubble_border.h"
-#include "views/bubble/bubble_delegate.h"
-#include "views/bubble/bubble_view.h"
-#include "views/widget/widget.h"
-
-namespace views {
-
-namespace {
-
-class TestBubbleDelegate : public BubbleDelegateView {
- public:
- explicit TestBubbleDelegate(Widget *frame): BubbleDelegateView(frame) {}
- SkColor GetFrameBackgroundColor() { return SK_ColorGREEN; }
- gfx::Rect GetBounds() { return gfx::Rect(10, 10, 200, 200); }
- BubbleBorder::ArrowLocation GetFrameArrowLocation() {
- return BubbleBorder::LEFT_BOTTOM;
- }
-};
-
-class TestAnimationDelegate : public ui::AnimationDelegate {
- public:
- TestAnimationDelegate():animation_progressed_(0), animation_ended_(0) {}
- void AnimationProgressed(const ui::Animation* animation) {
- ++animation_progressed_;
- }
- void AnimationEnded(const ui::Animation* animation) {
- ++animation_ended_;
- }
- int animation_progressed_;
- int animation_ended_;
-};
-
-
-TEST(BubbleViewBasicTest, CreateArrowBubble) {
- MessageLoopForUI message_loop;
- Widget* bubble_widget = new Widget();
- Widget::InitParams params(Widget::InitParams::TYPE_BUBBLE);
- TestBubbleDelegate* delegate = new TestBubbleDelegate(bubble_widget);
- params.delegate = delegate;
- bubble_widget->Init(params);
-
- BubbleBorder* border =
- static_cast<BubbleBorder*>(bubble_widget->non_client_view()
- ->frame_view()->border());
- EXPECT_EQ(delegate->GetFrameArrowLocation(), border->arrow_location());
- MessageLoop::current()->RunAllPending();
-}
-
-} // namespace
-
-TEST(BubbleViewTest, FadeAnimation) {
- MessageLoopForUI message_loop;
-
- Widget* bubble_widget = new Widget();
- Widget::InitParams params(Widget::InitParams::TYPE_BUBBLE);
- params.delegate = new TestBubbleDelegate(bubble_widget);
- bubble_widget->Init(params);
- bubble_widget->Show();
- BubbleView* bubble_view = bubble_widget->client_view()->AsBubbleView();
- TestAnimationDelegate test_animation_delegate;
- bubble_view->set_animation_delegate(&test_animation_delegate);
- bubble_view->StartFade();
-
- bubble_view->AnimationProgressed(bubble_view->fade_animation_.get());
- bubble_view->AnimationEnded(bubble_view->fade_animation_.get());
-
- EXPECT_LT(0, test_animation_delegate.animation_progressed_);
- EXPECT_EQ(1, test_animation_delegate.animation_ended_);
- MessageLoop::current()->RunAllPending();
-}
-
-} // namespace views