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 "chrome/browser/ui/views/bubble/bubble.h" | 5 #include "chrome/browser/ui/views/bubble/bubble.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/browser/ui/views/bubble/border_contents.h" | 9 #include "chrome/browser/ui/views/bubble/border_contents.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 border_contents_->SchedulePaint(); | 126 border_contents_->SchedulePaint(); |
127 #endif | 127 #endif |
128 } | 128 } |
129 | 129 |
130 Bubble::Bubble() | 130 Bubble::Bubble() |
131 : | 131 : |
132 #if defined(USE_AURA) | 132 #if defined(USE_AURA) |
133 views::NativeWidgetAura(new views::Widget), | 133 views::NativeWidgetAura(new views::Widget), |
134 #elif defined(OS_WIN) | 134 #elif defined(OS_WIN) |
135 views::NativeWidgetWin(new views::Widget), | 135 views::NativeWidgetWin(new views::Widget), |
136 #elif defined(TOUCH_UI) | |
137 views::NativeWidgetViews(new views::Widget), | |
138 #elif defined(TOOLKIT_USES_GTK) | 136 #elif defined(TOOLKIT_USES_GTK) |
139 views::NativeWidgetGtk(new views::Widget), | 137 views::NativeWidgetGtk(new views::Widget), |
140 #endif | 138 #endif |
141 #if defined(OS_WIN) && !defined(USE_AURA) | 139 #if defined(OS_WIN) && !defined(USE_AURA) |
142 border_(NULL), | 140 border_(NULL), |
143 #else | 141 #else |
144 border_contents_(NULL), | 142 border_contents_(NULL), |
145 #endif | 143 #endif |
146 delegate_(NULL), | 144 delegate_(NULL), |
147 show_status_(kOpen), | 145 show_status_(kOpen), |
148 fade_away_on_close_(false), | 146 fade_away_on_close_(false), |
149 close_on_deactivate_(true), | 147 close_on_deactivate_(true), |
150 #if defined(TOOLKIT_USES_GTK) | 148 #if defined(TOOLKIT_USES_GTK) |
151 type_(views::Widget::InitParams::TYPE_WINDOW_FRAMELESS), | 149 type_(views::Widget::InitParams::TYPE_WINDOW_FRAMELESS), |
152 #endif | 150 #endif |
153 #if defined(OS_CHROMEOS) | 151 #if defined(OS_CHROMEOS) |
154 show_while_screen_is_locked_(false), | 152 show_while_screen_is_locked_(false), |
155 #endif | 153 #endif |
156 arrow_location_(views::BubbleBorder::NONE), | 154 arrow_location_(views::BubbleBorder::NONE), |
157 contents_(NULL), | 155 contents_(NULL), |
158 accelerator_registered_(false) { | 156 accelerator_registered_(false) { |
159 } | 157 } |
160 | 158 |
161 #if defined(OS_CHROMEOS) | 159 #if defined(OS_CHROMEOS) |
162 Bubble::Bubble(views::Widget::InitParams::Type type, | 160 Bubble::Bubble(views::Widget::InitParams::Type type, |
163 bool show_while_screen_is_locked) | 161 bool show_while_screen_is_locked) |
164 #if defined(USE_AURA) | 162 #if defined(USE_AURA) |
165 : views::NativeWidgetAura(new views::Widget), | 163 : views::NativeWidgetAura(new views::Widget), |
166 #elif defined(TOUCH_UI) | |
167 : views::NativeWidgetViews(new views::Widget), | |
168 #else | 164 #else |
169 : views::NativeWidgetGtk(new views::Widget), | 165 : views::NativeWidgetGtk(new views::Widget), |
170 #endif | 166 #endif |
171 border_contents_(NULL), | 167 border_contents_(NULL), |
172 delegate_(NULL), | 168 delegate_(NULL), |
173 show_status_(kOpen), | 169 show_status_(kOpen), |
174 fade_away_on_close_(false), | 170 fade_away_on_close_(false), |
175 #if defined(TOOLKIT_USES_GTK) | 171 #if defined(TOOLKIT_USES_GTK) |
176 type_(type), | 172 type_(type), |
177 #endif | 173 #endif |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 delegate_->BubbleClosing(this, closed_by_escape); | 393 delegate_->BubbleClosing(this, closed_by_escape); |
398 FOR_EACH_OBSERVER(Observer, observer_list_, OnBubbleClosing()); | 394 FOR_EACH_OBSERVER(Observer, observer_list_, OnBubbleClosing()); |
399 show_status_ = kClosed; | 395 show_status_ = kClosed; |
400 #if defined(OS_WIN) && !defined(USE_AURA) | 396 #if defined(OS_WIN) && !defined(USE_AURA) |
401 border_->Close(); | 397 border_->Close(); |
402 #endif | 398 #endif |
403 #if defined(USE_AURA) | 399 #if defined(USE_AURA) |
404 NativeWidgetAura::Close(); | 400 NativeWidgetAura::Close(); |
405 #elif defined(OS_WIN) | 401 #elif defined(OS_WIN) |
406 NativeWidgetWin::Close(); | 402 NativeWidgetWin::Close(); |
407 #elif defined(TOUCH_UI) | |
408 NativeWidgetViews::Close(); | |
409 #elif defined(TOOLKIT_USES_GTK) | 403 #elif defined(TOOLKIT_USES_GTK) |
410 NativeWidgetGtk::Close(); | 404 NativeWidgetGtk::Close(); |
411 #endif | 405 #endif |
412 } | 406 } |
413 | 407 |
414 void Bubble::FadeIn() { | 408 void Bubble::FadeIn() { |
415 Fade(true); // |fade_in|. | 409 Fade(true); // |fade_in|. |
416 } | 410 } |
417 | 411 |
418 void Bubble::FadeOut() { | 412 void Bubble::FadeOut() { |
(...skipping 24 matching lines...) Expand all Loading... |
443 animation_->Hide(); | 437 animation_->Hide(); |
444 } | 438 } |
445 | 439 |
446 bool Bubble::AcceleratorPressed(const ui::Accelerator& accelerator) { | 440 bool Bubble::AcceleratorPressed(const ui::Accelerator& accelerator) { |
447 if (!delegate_ || delegate_->CloseOnEscape()) { | 441 if (!delegate_ || delegate_->CloseOnEscape()) { |
448 DoClose(true); | 442 DoClose(true); |
449 return true; | 443 return true; |
450 } | 444 } |
451 return false; | 445 return false; |
452 } | 446 } |
OLD | NEW |