| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 #elif defined(TOOLKIT_USES_GTK) | 317 #elif defined(TOOLKIT_USES_GTK) |
| 318 GetWidget()->Show(); | 318 GetWidget()->Show(); |
| 319 #endif | 319 #endif |
| 320 | 320 |
| 321 if (fade_in) | 321 if (fade_in) |
| 322 FadeIn(); | 322 FadeIn(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void Bubble::RegisterEscapeAccelerator() { | 325 void Bubble::RegisterEscapeAccelerator() { |
| 326 GetWidget()->GetFocusManager()->RegisterAccelerator( | 326 GetWidget()->GetFocusManager()->RegisterAccelerator( |
| 327 views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); | 327 ui::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); |
| 328 accelerator_registered_ = true; | 328 accelerator_registered_ = true; |
| 329 } | 329 } |
| 330 | 330 |
| 331 void Bubble::UnregisterEscapeAccelerator() { | 331 void Bubble::UnregisterEscapeAccelerator() { |
| 332 DCHECK(accelerator_registered_); | 332 DCHECK(accelerator_registered_); |
| 333 GetWidget()->GetFocusManager()->UnregisterAccelerator( | 333 GetWidget()->GetFocusManager()->UnregisterAccelerator( |
| 334 views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); | 334 ui::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); |
| 335 accelerator_registered_ = false; | 335 accelerator_registered_ = false; |
| 336 } | 336 } |
| 337 | 337 |
| 338 BorderContents* Bubble::CreateBorderContents() { | 338 BorderContents* Bubble::CreateBorderContents() { |
| 339 return new BorderContents(); | 339 return new BorderContents(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void Bubble::SizeToContents() { | 342 void Bubble::SizeToContents() { |
| 343 gfx::Rect window_bounds; | 343 gfx::Rect window_bounds; |
| 344 | 344 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 animation_->SetSlideDuration(kHideFadeDurationMS); | 436 animation_->SetSlideDuration(kHideFadeDurationMS); |
| 437 animation_->SetTweenType(ui::Tween::LINEAR); | 437 animation_->SetTweenType(ui::Tween::LINEAR); |
| 438 | 438 |
| 439 animation_->Reset(fade_in ? 0.0 : 1.0); | 439 animation_->Reset(fade_in ? 0.0 : 1.0); |
| 440 if (fade_in) | 440 if (fade_in) |
| 441 animation_->Show(); | 441 animation_->Show(); |
| 442 else | 442 else |
| 443 animation_->Hide(); | 443 animation_->Hide(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 446 bool Bubble::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 447 if (!delegate_ || delegate_->CloseOnEscape()) { | 447 if (!delegate_ || delegate_->CloseOnEscape()) { |
| 448 DoClose(true); | 448 DoClose(true); |
| 449 return true; | 449 return true; |
| 450 } | 450 } |
| 451 return false; | 451 return false; |
| 452 } | 452 } |
| OLD | NEW |