OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notifications/balloon_view.h" | 5 #include "chrome/browser/ui/views/notifications/balloon_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 rect.set_height(GetShelfHeight()); | 503 rect.set_height(GetShelfHeight()); |
504 GetFrameMask(rect, &path); | 504 GetFrameMask(rect, &path); |
505 | 505 |
506 SkPaint paint; | 506 SkPaint paint; |
507 paint.setAntiAlias(true); | 507 paint.setAntiAlias(true); |
508 paint.setColor(kControlBarBackgroundColor); | 508 paint.setColor(kControlBarBackgroundColor); |
509 canvas->GetSkCanvas()->drawPath(path, paint); | 509 canvas->GetSkCanvas()->drawPath(path, paint); |
510 | 510 |
511 // Draw a 1-pixel gray line between the content and the menu bar. | 511 // Draw a 1-pixel gray line between the content and the menu bar. |
512 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; | 512 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; |
513 canvas->FillRect(kControlBarSeparatorLineColor, | 513 canvas->FillRect(gfx::Rect(kLeftMargin, 1 + GetShelfHeight(), line_width, 1), |
514 gfx::Rect(kLeftMargin, 1 + GetShelfHeight(), line_width, 1)); | 514 kControlBarSeparatorLineColor); |
515 | |
516 View::OnPaint(canvas); | 515 View::OnPaint(canvas); |
517 OnPaintBorder(canvas); | 516 OnPaintBorder(canvas); |
518 } | 517 } |
519 | 518 |
520 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 519 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
521 SizeContentsWindow(); | 520 SizeContentsWindow(); |
522 } | 521 } |
523 | 522 |
524 void BalloonViewImpl::Observe(int type, | 523 void BalloonViewImpl::Observe(int type, |
525 const content::NotificationSource& source, | 524 const content::NotificationSource& source, |
526 const content::NotificationDetails& details) { | 525 const content::NotificationDetails& details) { |
527 if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) { | 526 if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) { |
528 NOTREACHED(); | 527 NOTREACHED(); |
529 return; | 528 return; |
530 } | 529 } |
531 | 530 |
532 // If the renderer process attached to this balloon is disconnected | 531 // If the renderer process attached to this balloon is disconnected |
533 // (e.g., because of a crash), we want to close the balloon. | 532 // (e.g., because of a crash), we want to close the balloon. |
534 notification_registrar_.Remove( | 533 notification_registrar_.Remove( |
535 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 534 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
536 content::Source<Balloon>(balloon_)); | 535 content::Source<Balloon>(balloon_)); |
537 Close(false); | 536 Close(false); |
538 } | 537 } |
OLD | NEW |