| 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/info_bubble.h" | 5 #include "chrome/browser/ui/views/info_bubble.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/keyboard_codes.h" | |
| 10 #include "chrome/browser/ui/window_sizer.h" | 9 #include "chrome/browser/ui/window_sizer.h" |
| 11 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| 12 #include "gfx/canvas_skia.h" | 11 #include "gfx/canvas_skia.h" |
| 13 #include "gfx/color_utils.h" | 12 #include "gfx/color_utils.h" |
| 14 #include "gfx/path.h" | 13 #include "gfx/path.h" |
| 15 #include "third_party/skia/include/core/SkPaint.h" | 14 #include "third_party/skia/include/core/SkPaint.h" |
| 16 #include "ui/base/animation/slide_animation.h" | 15 #include "ui/base/animation/slide_animation.h" |
| 16 #include "ui/base/keycodes/keyboard_codes.h" |
| 17 #include "views/fill_layout.h" | 17 #include "views/fill_layout.h" |
| 18 #include "views/widget/root_view.h" | 18 #include "views/widget/root_view.h" |
| 19 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
| 20 #include "views/window/client_view.h" | 20 #include "views/window/client_view.h" |
| 21 #include "views/window/window.h" | 21 #include "views/window/window.h" |
| 22 | 22 |
| 23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
| 24 #include "chrome/browser/chromeos/wm_ipc.h" | 24 #include "chrome/browser/chromeos/wm_ipc.h" |
| 25 #include "third_party/cros/chromeos_wm_ipc_enums.h" | 25 #include "third_party/cros/chromeos_wm_ipc_enums.h" |
| 26 #endif | 26 #endif |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 // |contents_view| has no layout manager, so we have to explicitly position | 443 // |contents_view| has no layout manager, so we have to explicitly position |
| 444 // its children. | 444 // its children. |
| 445 border_contents_->SetBounds(gfx::Rect(gfx::Point(), window_bounds.size())); | 445 border_contents_->SetBounds(gfx::Rect(gfx::Point(), window_bounds.size())); |
| 446 contents->SetBounds(contents_bounds); | 446 contents->SetBounds(contents_bounds); |
| 447 #endif | 447 #endif |
| 448 SetBounds(window_bounds); | 448 SetBounds(window_bounds); |
| 449 | 449 |
| 450 // Register the Escape accelerator for closing. | 450 // Register the Escape accelerator for closing. |
| 451 GetFocusManager()->RegisterAccelerator( | 451 GetFocusManager()->RegisterAccelerator( |
| 452 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); | 452 views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); |
| 453 | 453 |
| 454 // Done creating the bubble. | 454 // Done creating the bubble. |
| 455 NotificationService::current()->Notify(NotificationType::INFO_BUBBLE_CREATED, | 455 NotificationService::current()->Notify(NotificationType::INFO_BUBBLE_CREATED, |
| 456 Source<InfoBubble>(this), | 456 Source<InfoBubble>(this), |
| 457 NotificationService::NoDetails()); | 457 NotificationService::NoDetails()); |
| 458 | 458 |
| 459 // Show the window. | 459 // Show the window. |
| 460 #if defined(OS_WIN) | 460 #if defined(OS_WIN) |
| 461 border_->ShowWindow(SW_SHOW); | 461 border_->ShowWindow(SW_SHOW); |
| 462 ShowWindow(SW_SHOW); | 462 ShowWindow(SW_SHOW); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 if (!IsActive()) | 507 if (!IsActive()) |
| 508 Close(); | 508 Close(); |
| 509 } | 509 } |
| 510 #endif | 510 #endif |
| 511 | 511 |
| 512 void InfoBubble::DoClose(bool closed_by_escape) { | 512 void InfoBubble::DoClose(bool closed_by_escape) { |
| 513 if (show_status_ == kClosed) | 513 if (show_status_ == kClosed) |
| 514 return; | 514 return; |
| 515 | 515 |
| 516 GetFocusManager()->UnregisterAccelerator( | 516 GetFocusManager()->UnregisterAccelerator( |
| 517 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); | 517 views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); |
| 518 if (delegate_) | 518 if (delegate_) |
| 519 delegate_->InfoBubbleClosing(this, closed_by_escape); | 519 delegate_->InfoBubbleClosing(this, closed_by_escape); |
| 520 show_status_ = kClosed; | 520 show_status_ = kClosed; |
| 521 #if defined(OS_WIN) | 521 #if defined(OS_WIN) |
| 522 border_->Close(); | 522 border_->Close(); |
| 523 WidgetWin::Close(); | 523 WidgetWin::Close(); |
| 524 #elif defined(OS_LINUX) | 524 #elif defined(OS_LINUX) |
| 525 WidgetGtk::Close(); | 525 WidgetGtk::Close(); |
| 526 #endif | 526 #endif |
| 527 } | 527 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 556 animation_->Hide(); | 556 animation_->Hide(); |
| 557 } | 557 } |
| 558 | 558 |
| 559 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 559 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 560 if (!delegate_ || delegate_->CloseOnEscape()) { | 560 if (!delegate_ || delegate_->CloseOnEscape()) { |
| 561 DoClose(true); | 561 DoClose(true); |
| 562 return true; | 562 return true; |
| 563 } | 563 } |
| 564 return false; | 564 return false; |
| 565 } | 565 } |
| OLD | NEW |