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

Side by Side Diff: chrome/browser/ui/views/info_bubble.h

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "app/animation_delegate.h"
10 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/animation/animation_delegate.h"
11 #include "views/accelerator.h" 11 #include "views/accelerator.h"
12 #include "views/view.h" 12 #include "views/view.h"
13 #include "chrome/browser/views/bubble_border.h" 13 #include "chrome/browser/views/bubble_border.h"
14 14
15 #if defined(OS_WIN) 15 #if defined(OS_WIN)
16 #include "views/widget/widget_win.h" 16 #include "views/widget/widget_win.h"
17 #elif defined(OS_LINUX) 17 #elif defined(OS_LINUX)
18 #include "views/widget/widget_gtk.h" 18 #include "views/widget/widget_gtk.h"
19 #endif 19 #endif
20 20
21 // InfoBubble is used to display an arbitrary view above all other windows. 21 // InfoBubble is used to display an arbitrary view above all other windows.
22 // Think of InfoBubble as a tooltip that allows you to embed an arbitrary view 22 // Think of InfoBubble as a tooltip that allows you to embed an arbitrary view
23 // in the tooltip. Additionally the InfoBubble renders an arrow pointing at 23 // in the tooltip. Additionally the InfoBubble renders an arrow pointing at
24 // the region the info bubble is providing the information about. 24 // the region the info bubble is providing the information about.
25 // 25 //
26 // To use an InfoBubble, invoke Show() and it'll take care of the rest. The 26 // To use an InfoBubble, invoke Show() and it'll take care of the rest. The
27 // InfoBubble insets the contents for you, so the contents typically shouldn't 27 // InfoBubble insets the contents for you, so the contents typically shouldn't
28 // have any additional margins. 28 // have any additional margins.
29 29
30 #if defined(OS_WIN)
31 class BorderWidget;
32 #endif
30 class InfoBubble; 33 class InfoBubble;
34
35 namespace gfx {
36 class Path;
37 }
38
39 namespace ui {
31 class SlideAnimation; 40 class SlideAnimation;
41 }
32 42
33 namespace views { 43 namespace views {
34 class Widget; 44 class Widget;
35 } 45 }
36 46
37 namespace gfx {
38 class Path;
39 }
40
41 #if defined(OS_WIN)
42 class BorderWidget;
43 #endif
44
45 // This is used to paint the border of the InfoBubble. Windows uses this via 47 // This is used to paint the border of the InfoBubble. Windows uses this via
46 // BorderWidget (see below), while others can use it directly in the bubble. 48 // BorderWidget (see below), while others can use it directly in the bubble.
47 class BorderContents : public views::View { 49 class BorderContents : public views::View {
48 public: 50 public:
49 BorderContents() : bubble_border_(NULL) { } 51 BorderContents() : bubble_border_(NULL) { }
50 52
51 // Must be called before this object can be used. 53 // Must be called before this object can be used.
52 void Init(); 54 void Init();
53 55
54 // Given the size of the contents and the rect to point at, returns the bounds 56 // Given the size of the contents and the rect to point at, returns the bounds
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the 177 // TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the
176 // WidgetFoo subclass into a separate class that calls into InfoBubble. 178 // WidgetFoo subclass into a separate class that calls into InfoBubble.
177 // That way InfoBubble has no (or very few) ifdefs. 179 // That way InfoBubble has no (or very few) ifdefs.
178 class InfoBubble 180 class InfoBubble
179 #if defined(OS_WIN) 181 #if defined(OS_WIN)
180 : public views::WidgetWin, 182 : public views::WidgetWin,
181 #elif defined(OS_LINUX) 183 #elif defined(OS_LINUX)
182 : public views::WidgetGtk, 184 : public views::WidgetGtk,
183 #endif 185 #endif
184 public views::AcceleratorTarget, 186 public views::AcceleratorTarget,
185 public AnimationDelegate { 187 public ui::AnimationDelegate {
186 public: 188 public:
187 // Shows the InfoBubble. |parent| is set as the parent window, |contents| are 189 // Shows the InfoBubble. |parent| is set as the parent window, |contents| are
188 // the contents shown in the bubble, and |position_relative_to| is a rect in 190 // the contents shown in the bubble, and |position_relative_to| is a rect in
189 // screen coordinates at which the InfoBubble will point. Show() takes 191 // screen coordinates at which the InfoBubble will point. Show() takes
190 // ownership of |contents| and deletes the created InfoBubble when another 192 // ownership of |contents| and deletes the created InfoBubble when another
191 // window is activated. You can explicitly close the bubble by invoking 193 // window is activated. You can explicitly close the bubble by invoking
192 // Close(). |arrow_location| specifies preferred bubble alignment. 194 // Close(). |arrow_location| specifies preferred bubble alignment.
193 // You may provide an optional |delegate| to: 195 // You may provide an optional |delegate| to:
194 // - Be notified when the InfoBubble is closed. 196 // - Be notified when the InfoBubble is closed.
195 // - Prevent the InfoBubble from being closed when the Escape key is 197 // - Prevent the InfoBubble from being closed when the Escape key is
(...skipping 26 matching lines...) Expand all
222 // we use FadeOut when the user selects something within the bubble that 224 // we use FadeOut when the user selects something within the bubble that
223 // causes the bubble to dismiss. We don't use it when the bubble gets 225 // causes the bubble to dismiss. We don't use it when the bubble gets
224 // deactivated as a result of clicking outside the bubble. 226 // deactivated as a result of clicking outside the bubble.
225 void set_fade_away_on_close(bool fade_away_on_close) { 227 void set_fade_away_on_close(bool fade_away_on_close) {
226 fade_away_on_close_ = fade_away_on_close; 228 fade_away_on_close_ = fade_away_on_close;
227 } 229 }
228 230
229 // Overridden from WidgetWin: 231 // Overridden from WidgetWin:
230 virtual void Close(); 232 virtual void Close();
231 233
232 // Overridden from AnimationDelegate: 234 // Overridden from ui::AnimationDelegate:
233 virtual void AnimationEnded(const Animation* animation); 235 virtual void AnimationEnded(const ui::Animation* animation);
234 virtual void AnimationProgressed(const Animation* animation); 236 virtual void AnimationProgressed(const ui::Animation* animation);
235 237
236 static const SkColor kBackgroundColor; 238 static const SkColor kBackgroundColor;
237 239
238 protected: 240 protected:
239 InfoBubble(); 241 InfoBubble();
240 #if defined(OS_CHROMEOS) 242 #if defined(OS_CHROMEOS)
241 InfoBubble(views::WidgetGtk::Type type, bool show_while_screen_is_locked); 243 InfoBubble(views::WidgetGtk::Type type, bool show_while_screen_is_locked);
242 #endif 244 #endif
243 virtual ~InfoBubble(); 245 virtual ~InfoBubble();
244 246
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // Animates to a visible/hidden state (visible if |fade_in| is true). 290 // Animates to a visible/hidden state (visible if |fade_in| is true).
289 void Fade(bool fade_in); 291 void Fade(bool fade_in);
290 292
291 // Overridden from AcceleratorTarget: 293 // Overridden from AcceleratorTarget:
292 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); 294 virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
293 295
294 // The delegate, if any. 296 // The delegate, if any.
295 InfoBubbleDelegate* delegate_; 297 InfoBubbleDelegate* delegate_;
296 298
297 // The animation used to fade the bubble out. 299 // The animation used to fade the bubble out.
298 scoped_ptr<SlideAnimation> animation_; 300 scoped_ptr<ui::SlideAnimation> animation_;
299 301
300 // The current visibility status of the bubble. 302 // The current visibility status of the bubble.
301 ShowStatus show_status_; 303 ShowStatus show_status_;
302 304
303 // Whether to fade away when the bubble closes. 305 // Whether to fade away when the bubble closes.
304 bool fade_away_on_close_; 306 bool fade_away_on_close_;
305 307
306 #if defined(OS_CHROMEOS) 308 #if defined(OS_CHROMEOS)
307 // Should we set a property telling the window manager to show this window 309 // Should we set a property telling the window manager to show this window
308 // onscreen even when the screen is locked? 310 // onscreen even when the screen is locked?
309 bool show_while_screen_is_locked_; 311 bool show_while_screen_is_locked_;
310 #endif 312 #endif
311 313
312 gfx::Rect position_relative_to_; 314 gfx::Rect position_relative_to_;
313 BubbleBorder::ArrowLocation arrow_location_; 315 BubbleBorder::ArrowLocation arrow_location_;
314 316
315 views::View* contents_; 317 views::View* contents_;
316 318
317 DISALLOW_COPY_AND_ASSIGN(InfoBubble); 319 DISALLOW_COPY_AND_ASSIGN(InfoBubble);
318 }; 320 };
319 321
320 #endif // CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_ 322 #endif // CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/fullscreen_exit_bubble.cc ('k') | chrome/browser/ui/views/info_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698