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

Unified Diff: views/bubble/bubble_delegate.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_border.cc ('k') | views/bubble/bubble_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/bubble/bubble_delegate.h
diff --git a/views/bubble/bubble_delegate.h b/views/bubble/bubble_delegate.h
index 32cf0a459b6a5fd3cf7ab4e36f04c25a298b8a06..3b303f77e70fe852764757c75b5c717e07fb88ba 100644
--- a/views/bubble/bubble_delegate.h
+++ b/views/bubble/bubble_delegate.h
@@ -6,56 +6,52 @@
#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.
+// BubbleDelegateView creates frame and client views for bubble Widgets.
+// BubbleDelegateView itself is the client's contents view.
//
///////////////////////////////////////////////////////////////////////////////
-class VIEWS_EXPORT BubbleDelegate : public WidgetDelegate {
+class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView {
public:
- virtual BubbleDelegate* AsBubbleDelegate() OVERRIDE;
+ virtual ~BubbleDelegateView();
+
+ // Create a bubble Widget from the argument BubbleDelegateView.
+ static Widget* CreateBubble(BubbleDelegateView* bubble_delegate,
+ Widget* parent_widget);
+
+ // WidgetDelegate overrides:
+ virtual View* GetContentsView() OVERRIDE { return this; }
virtual ClientView* CreateClientView(Widget* widget) OVERRIDE;
virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
- virtual SkColor GetFrameBackgroundColor() = 0;
- virtual gfx::Rect GetBounds() = 0;
- virtual BubbleBorder::ArrowLocation GetFrameArrowLocation() = 0;
+ // Get the arrow's anchor point in screen space.
+ virtual gfx::Point GetAnchorPoint() const;
- const BubbleView* GetBubbleView() const;
- BubbleView* GetBubbleView();
+ // Get the arrow's location on the bubble.
+ virtual BubbleBorder::ArrowLocation GetArrowLocation() const {
+ return BubbleBorder::TOP_LEFT;
+ }
- const BubbleFrameView* GetBubbleFrameView() const;
- BubbleFrameView* GetBubbleFrameView();
+ // Get the color used for the background and border.
+ virtual SkColor GetColor() const { return SK_ColorWHITE; }
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;
+ // Perform view initialization on the contents for bubble sizing.
+ virtual void Init() {}
private:
- Widget* frame_;
- DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
+ const BubbleView* GetBubbleView() const;
+ const BubbleFrameView* GetBubbleFrameView() const;
+
+ // Get bubble bounds from the anchor point and client view's preferred size.
+ gfx::Rect GetBubbleBounds();
};
} // namespace views
« no previous file with comments | « views/bubble/bubble_border.cc ('k') | views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698