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

Side by Side Diff: ui/aura_shell/examples/bubble.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | ui/aura_shell/examples/example_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "views/bubble/bubble_border.h" 6 #include "views/bubble/bubble_border.h"
7 #include "views/bubble/bubble_delegate.h" 7 #include "views/bubble/bubble_delegate.h"
8 #include "views/controls/label.h" 8 #include "views/controls/label.h"
9 #include "views/layout/fill_layout.h" 9 #include "views/layout/fill_layout.h"
10 #include "views/widget/widget.h" 10 #include "views/widget/widget.h"
11 11
12 namespace aura_shell { 12 namespace aura_shell {
13 namespace examples { 13 namespace examples {
14 14
15 struct BubbleConfig { 15 struct BubbleConfig {
16 string16 label; 16 string16 label;
17 SkColor color; 17 SkColor color;
18 gfx::Point anchor_point; 18 views::View* anchor_view;
19 views::BubbleBorder::ArrowLocation arrow; 19 views::BubbleBorder::ArrowLocation arrow;
20 }; 20 };
21 21
22 class ExampleBubbleDelegateView : public views::BubbleDelegateView { 22 class ExampleBubbleDelegateView : public views::BubbleDelegateView {
23 public: 23 public:
24 ExampleBubbleDelegateView(const BubbleConfig& config) 24 ExampleBubbleDelegateView(const BubbleConfig& config)
25 : BubbleDelegateView(config.anchor_point, config.arrow, config.color), 25 : BubbleDelegateView(config.anchor_view, config.arrow, config.color),
26 label_(config.label) {} 26 label_(config.label) {}
27 27
28 virtual void Init() OVERRIDE { 28 virtual void Init() OVERRIDE {
29 SetLayoutManager(new views::FillLayout()); 29 SetLayoutManager(new views::FillLayout());
30 views::Label* label = new views::Label(label_); 30 views::Label* label = new views::Label(label_);
31 label->set_border(views::Border::CreateSolidBorder(10, GetColor()));
32 AddChildView(label); 31 AddChildView(label);
33 } 32 }
34 33
35 private: 34 private:
36 string16 label_; 35 string16 label_;
37 }; 36 };
38 37
39 void CreatePointyBubble(views::Widget* parent, const gfx::Point& origin) { 38 void CreatePointyBubble(views::View* anchor_view) {
40 BubbleConfig config; 39 BubbleConfig config;
41 config.label = ASCIIToUTF16("PointyBubble"); 40 config.label = ASCIIToUTF16("PointyBubble");
42 config.color = SK_ColorWHITE; 41 config.color = SK_ColorWHITE;
43 config.anchor_point = origin; 42 config.anchor_view = anchor_view;
44 config.arrow = views::BubbleBorder::TOP_LEFT; 43 config.arrow = views::BubbleBorder::TOP_LEFT;
45 views::Widget* bubble = views::BubbleDelegateView::CreateBubble( 44 ExampleBubbleDelegateView* bubble = new ExampleBubbleDelegateView(config);
46 new ExampleBubbleDelegateView(config), parent); 45 views::BubbleDelegateView::CreateBubble(bubble);
47 bubble->Show(); 46 bubble->Show();
48 } 47 }
49 48
50 } // namespace examples 49 } // namespace examples
51 } // namespace aura_shell 50 } // namespace aura_shell
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | ui/aura_shell/examples/example_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698