summaryrefslogtreecommitdiffstats
path: root/ash/shell/bubble.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 20:17:01 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 20:17:01 +0000
commitca9c23002e3e9d6325e6bddae60341f67dd4f460 (patch)
treed687c041da38970a6872e6b2e0c6543b083f01dd /ash/shell/bubble.cc
parent240502342713279f648c1b21a889e52d19b91ff1 (diff)
downloadchromium_src-ca9c23002e3e9d6325e6bddae60341f67dd4f460.zip
chromium_src-ca9c23002e3e9d6325e6bddae60341f67dd4f460.tar.gz
chromium_src-ca9c23002e3e9d6325e6bddae60341f67dd4f460.tar.bz2
Create the new toplevel directory ash, and move the shell examples in it as a seed.
Examples are now known as "shell". (I will rename aura_shell::Shell to something else in a pending CL). http://crbug.com/108457 TEST=none TBR=sky Review URL: http://codereview.chromium.org/9026012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115588 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell/bubble.cc')
-rw-r--r--ash/shell/bubble.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/ash/shell/bubble.cc b/ash/shell/bubble.cc
new file mode 100644
index 0000000..0b14ad6
--- /dev/null
+++ b/ash/shell/bubble.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/utf_string_conversions.h"
+#include "ui/views/bubble/bubble_border.h"
+#include "ui/views/bubble/bubble_delegate.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/layout/fill_layout.h"
+#include "ui/views/widget/widget.h"
+
+namespace ash {
+namespace shell {
+
+struct BubbleConfig {
+ string16 label;
+ views::View* anchor_view;
+ views::BubbleBorder::ArrowLocation arrow;
+};
+
+class ExampleBubbleDelegateView : public views::BubbleDelegateView {
+ public:
+ ExampleBubbleDelegateView(const BubbleConfig& config)
+ : BubbleDelegateView(config.anchor_view, config.arrow),
+ label_(config.label) {}
+
+ virtual void Init() OVERRIDE {
+ SetLayoutManager(new views::FillLayout());
+ views::Label* label = new views::Label(label_);
+ AddChildView(label);
+ }
+
+ private:
+ string16 label_;
+};
+
+void CreatePointyBubble(views::View* anchor_view) {
+ BubbleConfig config;
+ config.label = ASCIIToUTF16("PointyBubble");
+ config.anchor_view = anchor_view;
+ config.arrow = views::BubbleBorder::TOP_LEFT;
+ ExampleBubbleDelegateView* bubble = new ExampleBubbleDelegateView(config);
+ views::BubbleDelegateView::CreateBubble(bubble);
+ bubble->Show();
+}
+
+} // namespace shell
+} // namespace ash