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

Unified Diff: views/bubble/bubble_view.h

Issue 8227003: Views Bubble API adjustments and cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add close_on_esc setting and fade-in functionality. Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/bubble/bubble_frame_view_unittest.cc ('k') | views/bubble/bubble_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/bubble/bubble_view.h
diff --git a/views/bubble/bubble_view.h b/views/bubble/bubble_view.h
index 948b39f2f3b4b4d29800ea0001a5265712f17371..26631991ba52778db563aceefcadb679ceea728c 100644
--- a/views/bubble/bubble_view.h
+++ b/views/bubble/bubble_view.h
@@ -6,14 +6,8 @@
#define VIEWS_BUBBLE_BUBBLE_VIEW_H_
#pragma once
-#include <string>
-
-#include "base/gtest_prod_util.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 {
@@ -22,61 +16,35 @@ class SlideAnimation;
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();
+ // ClientView overrides:
+ virtual BubbleView* AsBubbleView() OVERRIDE { return this; }
+ virtual const BubbleView* AsBubbleView() const OVERRIDE { return this; }
- void set_animation_delegate(ui::AnimationDelegate* delegate);
+ void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
- virtual BubbleView* AsBubbleView() OVERRIDE;
- virtual const BubbleView* AsBubbleView() const OVERRIDE;
+ // Starts a fade animation, fade out closes the widget upon completion.
+ void StartFade(bool fade_in);
protected:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child) OVERRIDE;
-
+ // View overrides:
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.
+ // ui::AnimationDelegate overrides:
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_;
+ // Should this bubble close on the escape key?
+ bool close_on_esc_;
DISALLOW_COPY_AND_ASSIGN(BubbleView);
};
« no previous file with comments | « views/bubble/bubble_frame_view_unittest.cc ('k') | views/bubble/bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698