| 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 "app/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_skia.h" | 10 #include "gfx/canvas_skia.h" |
| 11 #include "gfx/color_utils.h" | 11 #include "gfx/color_utils.h" |
| 12 #include "gfx/path.h" | 12 #include "gfx/path.h" |
| 13 #include "third_party/skia/include/core/SkPaint.h" | 13 #include "third_party/skia/include/core/SkPaint.h" |
| 14 #include "views/fill_layout.h" | 14 #include "views/fill_layout.h" |
| 15 #include "views/widget/root_view.h" | 15 #include "views/widget/root_view.h" |
| 16 #include "views/widget/widget.h" | 16 #include "views/widget/widget.h" |
| 17 #include "views/window/client_view.h" | 17 #include "views/window/client_view.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 // |contents_view| has no layout manager, so we have to explicitly position | 420 // |contents_view| has no layout manager, so we have to explicitly position |
| 421 // its children. | 421 // its children. |
| 422 border_contents_->SetBounds(gfx::Rect(gfx::Point(), window_bounds.size())); | 422 border_contents_->SetBounds(gfx::Rect(gfx::Point(), window_bounds.size())); |
| 423 contents->SetBounds(contents_bounds); | 423 contents->SetBounds(contents_bounds); |
| 424 #endif | 424 #endif |
| 425 SetBounds(window_bounds); | 425 SetBounds(window_bounds); |
| 426 | 426 |
| 427 // Register the Escape accelerator for closing. | 427 // Register the Escape accelerator for closing. |
| 428 GetFocusManager()->RegisterAccelerator( | 428 GetFocusManager()->RegisterAccelerator( |
| 429 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); | 429 views::Accelerator(base::VKEY_ESCAPE, false, false, false), this); |
| 430 | 430 |
| 431 // Done creating the bubble. | 431 // Done creating the bubble. |
| 432 NotificationService::current()->Notify(NotificationType::INFO_BUBBLE_CREATED, | 432 NotificationService::current()->Notify(NotificationType::INFO_BUBBLE_CREATED, |
| 433 Source<InfoBubble>(this), | 433 Source<InfoBubble>(this), |
| 434 NotificationService::NoDetails()); | 434 NotificationService::NoDetails()); |
| 435 | 435 |
| 436 // Show the window. | 436 // Show the window. |
| 437 #if defined(OS_WIN) | 437 #if defined(OS_WIN) |
| 438 border_->ShowWindow(SW_SHOW); | 438 border_->ShowWindow(SW_SHOW); |
| 439 ShowWindow(SW_SHOW); | 439 ShowWindow(SW_SHOW); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if (!IsActive()) | 484 if (!IsActive()) |
| 485 Close(); | 485 Close(); |
| 486 } | 486 } |
| 487 #endif | 487 #endif |
| 488 | 488 |
| 489 void InfoBubble::DoClose(bool closed_by_escape) { | 489 void InfoBubble::DoClose(bool closed_by_escape) { |
| 490 if (show_status_ == kClosed) | 490 if (show_status_ == kClosed) |
| 491 return; | 491 return; |
| 492 | 492 |
| 493 GetFocusManager()->UnregisterAccelerator( | 493 GetFocusManager()->UnregisterAccelerator( |
| 494 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); | 494 views::Accelerator(base::VKEY_ESCAPE, false, false, false), this); |
| 495 if (delegate_) | 495 if (delegate_) |
| 496 delegate_->InfoBubbleClosing(this, closed_by_escape); | 496 delegate_->InfoBubbleClosing(this, closed_by_escape); |
| 497 show_status_ = kClosed; | 497 show_status_ = kClosed; |
| 498 #if defined(OS_WIN) | 498 #if defined(OS_WIN) |
| 499 border_->Close(); | 499 border_->Close(); |
| 500 WidgetWin::Close(); | 500 WidgetWin::Close(); |
| 501 #elif defined(OS_LINUX) | 501 #elif defined(OS_LINUX) |
| 502 WidgetGtk::Close(); | 502 WidgetGtk::Close(); |
| 503 #endif | 503 #endif |
| 504 } | 504 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 533 animation_->Hide(); | 533 animation_->Hide(); |
| 534 } | 534 } |
| 535 | 535 |
| 536 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 536 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 537 if (!delegate_ || delegate_->CloseOnEscape()) { | 537 if (!delegate_ || delegate_->CloseOnEscape()) { |
| 538 DoClose(true); | 538 DoClose(true); |
| 539 return true; | 539 return true; |
| 540 } | 540 } |
| 541 return false; | 541 return false; |
| 542 } | 542 } |
| OLD | NEW |