Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/examples/bubble_example.h" | 5 #include "views/examples/bubble_example.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "views/bubble/bubble_delegate.h" | 8 #include "views/bubble/bubble_delegate.h" |
| 9 #include "views/controls/button/text_button.h" | 9 #include "views/controls/button/text_button.h" |
| 10 #include "views/controls/label.h" | 10 #include "views/controls/label.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 config = kFadeOutConfig; | 83 config = kFadeOutConfig; |
| 84 | 84 |
| 85 config.anchor_point.set_x(sender->width() / 2); | 85 config.anchor_point.set_x(sender->width() / 2); |
| 86 config.anchor_point.set_y(sender->height() / 2); | 86 config.anchor_point.set_y(sender->height() / 2); |
| 87 views::View::ConvertPointToScreen(sender, &config.anchor_point); | 87 views::View::ConvertPointToScreen(sender, &config.anchor_point); |
| 88 | 88 |
| 89 ExampleBubbleDelegateView* bubble_delegate = | 89 ExampleBubbleDelegateView* bubble_delegate = |
| 90 new ExampleBubbleDelegateView(config); | 90 new ExampleBubbleDelegateView(config); |
| 91 views::Widget* bubble = views::BubbleDelegateView::CreateBubble( | 91 views::Widget* bubble = views::BubbleDelegateView::CreateBubble( |
| 92 bubble_delegate, example_view()->GetWidget()); | 92 bubble_delegate, example_view()->GetWidget()); |
| 93 DCHECK(bubble); | |
|
Ben Goodger (Google)
2011/10/31 17:43:02
Looking at your code, CreateBubble can never retur
msw
2011/10/31 17:47:37
To silence a clang error for the otherwise unused
Ben Goodger (Google)
2011/10/31 17:48:29
Why not nix the variable then?
msw
2011/10/31 17:56:33
Done. I thought it might help fill out the example
| |
| 93 | 94 |
| 94 if (config.fade_in) | 95 if (config.fade_in) |
| 95 bubble_delegate->StartFade(true); | 96 bubble_delegate->StartFade(true); |
| 96 else | 97 else |
| 97 bubble->Show(); | 98 bubble_delegate->Show(); |
| 98 | 99 |
| 99 if (config.fade_out) { | 100 if (config.fade_out) { |
| 100 bubble_delegate->set_close_on_esc(false); | 101 bubble_delegate->set_close_on_esc(false); |
| 101 bubble_delegate->StartFade(false); | 102 bubble_delegate->StartFade(false); |
| 102 } | 103 } |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace examples | 106 } // namespace examples |
| OLD | NEW |