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

Unified Diff: views/examples/bubble_example.cc

Issue 8368016: Rebase BookmarkBubble on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only SelectAll on the title textfield when the buble is first shown. Created 9 years, 1 month 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/examples/bubble_example.cc
diff --git a/views/examples/bubble_example.cc b/views/examples/bubble_example.cc
index d7011a1845f8eb47552d3b8e75f9348865be63eb..a5466c512364810a6359d274a7cea0852612bff8 100644
--- a/views/examples/bubble_example.cc
+++ b/views/examples/bubble_example.cc
@@ -17,7 +17,7 @@ namespace examples {
struct BubbleConfig {
string16 label;
SkColor color;
- gfx::Point anchor_point;
+ views::View* anchor_view;
views::BubbleBorder::ArrowLocation arrow;
bool fade_in;
bool fade_out;
@@ -25,19 +25,19 @@ struct BubbleConfig {
// Create four types of bubbles, one without arrow, one with an arrow, one
// that fades in, and another that fades out and won't close on the escape key.
-BubbleConfig kRoundConfig = { ASCIIToUTF16("RoundBubble"), 0xFFC1B1E1,
- gfx::Point(), views::BubbleBorder::NONE, false, false };
-BubbleConfig kArrowConfig = { ASCIIToUTF16("ArrowBubble"), SK_ColorGRAY,
- gfx::Point(), views::BubbleBorder::TOP_LEFT, false, false };
-BubbleConfig kFadeInConfig = { ASCIIToUTF16("FadeInBubble"), SK_ColorYELLOW,
- gfx::Point(), views::BubbleBorder::BOTTOM_RIGHT, true, false };
-BubbleConfig kFadeOutConfig = { ASCIIToUTF16("FadeOutBubble"), SK_ColorWHITE,
- gfx::Point(), views::BubbleBorder::BOTTOM_RIGHT, false, true };
+BubbleConfig kRoundConfig = { ASCIIToUTF16("Round"), 0xFFC1B1E1, NULL,
+ views::BubbleBorder::NONE, false, false };
+BubbleConfig kArrowConfig = { ASCIIToUTF16("Arrow"), SK_ColorGRAY, NULL,
+ views::BubbleBorder::TOP_LEFT, false, false };
+BubbleConfig kFadeInConfig = { ASCIIToUTF16("FadeIn"), SK_ColorYELLOW, NULL,
+ views::BubbleBorder::BOTTOM_RIGHT, true, false };
+BubbleConfig kFadeOutConfig = { ASCIIToUTF16("FadeOut"), SK_ColorWHITE, NULL,
+ views::BubbleBorder::LEFT_TOP, false, true };
class ExampleBubbleDelegateView : public views::BubbleDelegateView {
public:
ExampleBubbleDelegateView(const BubbleConfig& config)
- : BubbleDelegateView(config.anchor_point, config.arrow, config.color),
+ : BubbleDelegateView(config.anchor_view, config.arrow, config.color),
label_(config.label) {}
protected:
@@ -81,14 +81,10 @@ void BubbleExample::ButtonPressed(views::Button* sender,
else if (sender == fade_out_)
config = kFadeOutConfig;
- config.anchor_point.set_x(sender->width() / 2);
- config.anchor_point.set_y(sender->height() / 2);
- views::View::ConvertPointToScreen(sender, &config.anchor_point);
-
+ config.anchor_view = sender;
ExampleBubbleDelegateView* bubble_delegate =
new ExampleBubbleDelegateView(config);
- views::BubbleDelegateView::CreateBubble(bubble_delegate,
- example_view()->GetWidget());
+ views::BubbleDelegateView::CreateBubble(bubble_delegate);
if (config.fade_in)
bubble_delegate->StartFade(true);
« no previous file with comments | « views/bubble/bubble_frame_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698