OLD | NEW |
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 #include "chrome/browser/views/info_bubble.h" | 5 #include "chrome/browser/views/info_bubble.h" |
6 | 6 |
7 #include "base/keyboard_codes.h" | 7 #include "base/keyboard_codes.h" |
8 #include "chrome/browser/window_sizer.h" | 8 #include "chrome/browser/window_sizer.h" |
9 #include "chrome/common/notification_service.h" | 9 #include "chrome/common/notification_service.h" |
10 #include "gfx/canvas.h" | 10 #include "gfx/canvas.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 BubbleBorder::ArrowLocation arrow_location, | 242 BubbleBorder::ArrowLocation arrow_location, |
243 views::View* contents, | 243 views::View* contents, |
244 InfoBubbleDelegate* delegate) { | 244 InfoBubbleDelegate* delegate) { |
245 InfoBubble* window = new InfoBubble; | 245 InfoBubble* window = new InfoBubble; |
246 window->Init(parent, position_relative_to, arrow_location, | 246 window->Init(parent, position_relative_to, arrow_location, |
247 contents, delegate); | 247 contents, delegate); |
248 return window; | 248 return window; |
249 } | 249 } |
250 | 250 |
251 void InfoBubble::Close() { | 251 void InfoBubble::Close() { |
| 252 GetFocusManager()->UnregisterAccelerator( |
| 253 views::Accelerator(base::VKEY_ESCAPE, false, false, false), this); |
| 254 |
252 if (fade_away_on_close_) | 255 if (fade_away_on_close_) |
253 FadeOut(); | 256 FadeOut(); |
254 else | 257 else |
255 Close(false); | 258 Close(false); |
256 } | 259 } |
257 | 260 |
258 void InfoBubble::AnimationEnded(const Animation* animation) { | 261 void InfoBubble::AnimationEnded(const Animation* animation) { |
259 if (static_cast<int>(animation_->GetCurrentValue()) == 0) { | 262 if (static_cast<int>(animation_->GetCurrentValue()) == 0) { |
260 // When fading out we just need to close the bubble at the end | 263 // When fading out we just need to close the bubble at the end |
261 Close(false); | 264 Close(false); |
(...skipping 29 matching lines...) Expand all Loading... |
291 WidgetGtk(TYPE_WINDOW), | 294 WidgetGtk(TYPE_WINDOW), |
292 border_contents_(NULL), | 295 border_contents_(NULL), |
293 #elif defined(OS_WIN) | 296 #elif defined(OS_WIN) |
294 border_(NULL), | 297 border_(NULL), |
295 #endif | 298 #endif |
296 delegate_(NULL), | 299 delegate_(NULL), |
297 closed_(false), | 300 closed_(false), |
298 fade_away_on_close_(false) { | 301 fade_away_on_close_(false) { |
299 } | 302 } |
300 | 303 |
| 304 #if defined(OS_CHROMEOS) |
| 305 InfoBubble::InfoBubble(views::WidgetGtk::Type type) |
| 306 : WidgetGtk(type), |
| 307 border_contents_(NULL), |
| 308 delegate_(NULL), |
| 309 closed_(false), |
| 310 fade_away_on_close_(false) { |
| 311 } |
| 312 #endif |
| 313 |
301 void InfoBubble::Init(views::Widget* parent, | 314 void InfoBubble::Init(views::Widget* parent, |
302 const gfx::Rect& position_relative_to, | 315 const gfx::Rect& position_relative_to, |
303 BubbleBorder::ArrowLocation arrow_location, | 316 BubbleBorder::ArrowLocation arrow_location, |
304 views::View* contents, | 317 views::View* contents, |
305 InfoBubbleDelegate* delegate) { | 318 InfoBubbleDelegate* delegate) { |
306 delegate_ = delegate; | 319 delegate_ = delegate; |
307 position_relative_to_ = position_relative_to; | 320 position_relative_to_ = position_relative_to; |
308 arrow_location_ = arrow_location; | 321 arrow_location_ = arrow_location; |
309 contents_ = contents; | 322 contents_ = contents; |
310 | 323 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 animation_->Hide(); | 514 animation_->Hide(); |
502 } | 515 } |
503 | 516 |
504 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 517 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
505 if (!delegate_ || delegate_->CloseOnEscape()) { | 518 if (!delegate_ || delegate_->CloseOnEscape()) { |
506 Close(true); | 519 Close(true); |
507 return true; | 520 return true; |
508 } | 521 } |
509 return false; | 522 return false; |
510 } | 523 } |
OLD | NEW |