diff options
author | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 15:14:26 +0000 |
---|---|---|
committer | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 15:14:26 +0000 |
commit | 05b6239f408bdee63ca049e441e46ba2e1ea38c9 (patch) | |
tree | 93f0a6897b86ba23972fbfa62e9f50784a2b40e4 /chrome/browser/views | |
parent | 5f6144320143716afd2b5e0291aa3e0bb784faa8 (diff) | |
download | chromium_src-05b6239f408bdee63ca049e441e46ba2e1ea38c9.zip chromium_src-05b6239f408bdee63ca049e441e46ba2e1ea38c9.tar.gz chromium_src-05b6239f408bdee63ca049e441e46ba2e1ea38c9.tar.bz2 |
InfoBubble::ShowFocusless() added not to grab the focus when being shown.
Interface taken from http://codereview.chromium.org/2682004.
BUG=http://crosbug.com/525
TEST=none
Review URL: http://codereview.chromium.org/2874004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/info_bubble.cc | 19 | ||||
-rw-r--r-- | chrome/browser/views/info_bubble.h | 10 |
2 files changed, 27 insertions, 2 deletions
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 11ba19b..7f1b4f2 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -248,12 +248,27 @@ InfoBubble* InfoBubble::Show(views::Widget* parent, return window; } +#if defined(OS_CHROMEOS) +// static +InfoBubble* InfoBubble::ShowFocusless( + views::Widget* parent, + const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + views::View* contents, + InfoBubbleDelegate* delegate) { + InfoBubble* window = new InfoBubble(views::WidgetGtk::TYPE_POPUP); + window->Init(parent, position_relative_to, arrow_location, + contents, delegate); + return window; +} +#endif + void InfoBubble::Close() { if (show_status_ != kOpen) return; show_status_ = kClosing; - + if (fade_away_on_close_) FadeOut(); else @@ -460,7 +475,7 @@ void InfoBubble::OnActivate(UINT action, BOOL minimized, HWND window) { if (action == WA_INACTIVE) { Close(); } else if (action == WA_ACTIVE) { - DCHECK(GetRootView()->GetChildViewCount() > 0); + DCHECK_GT(GetRootView()->GetChildViewCount(), 0); GetRootView()->GetChildViewAt(0)->RequestFocus(); } } diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h index 957d80a..30b3719 100644 --- a/chrome/browser/views/info_bubble.h +++ b/chrome/browser/views/info_bubble.h @@ -196,6 +196,16 @@ class InfoBubble views::View* contents, InfoBubbleDelegate* delegate); +#if defined(OS_CHROMEOS) + // Shows the InfoBubble not grabbing the focus. Others are the same as above. + // TYPE_POPUP widget is used to achieve the focusless effect. + static InfoBubble* ShowFocusless(views::Widget* parent, + const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + views::View* contents, + InfoBubbleDelegate* delegate); +#endif + // Resizes and potentially moves the InfoBubble to best accommodate the // contents preferred size. void SizeToContents(); |