| 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/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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 rect.set_height(GetShelfHeight()); | 484 rect.set_height(GetShelfHeight()); |
| 485 GetFrameMask(rect, &path); | 485 GetFrameMask(rect, &path); |
| 486 | 486 |
| 487 SkPaint paint; | 487 SkPaint paint; |
| 488 paint.setAntiAlias(true); | 488 paint.setAntiAlias(true); |
| 489 paint.setColor(kControlBarBackgroundColor); | 489 paint.setColor(kControlBarBackgroundColor); |
| 490 canvas->GetSkCanvas()->drawPath(path, paint); | 490 canvas->GetSkCanvas()->drawPath(path, paint); |
| 491 | 491 |
| 492 // Draw a 1-pixel gray line between the content and the menu bar. | 492 // Draw a 1-pixel gray line between the content and the menu bar. |
| 493 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; | 493 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; |
| 494 canvas->FillRectInt(kControlBarSeparatorLineColor, | 494 canvas->FillRect(kControlBarSeparatorLineColor, |
| 495 kLeftMargin, 1 + GetShelfHeight(), line_width, 1); | 495 gfx::Rect(kLeftMargin, 1 + GetShelfHeight(), line_width, 1)); |
| 496 | 496 |
| 497 View::OnPaint(canvas); | 497 View::OnPaint(canvas); |
| 498 OnPaintBorder(canvas); | 498 OnPaintBorder(canvas); |
| 499 } | 499 } |
| 500 | 500 |
| 501 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 501 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 502 SizeContentsWindow(); | 502 SizeContentsWindow(); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void BalloonViewImpl::Observe(int type, | 505 void BalloonViewImpl::Observe(int type, |
| 506 const content::NotificationSource& source, | 506 const content::NotificationSource& source, |
| 507 const content::NotificationDetails& details) { | 507 const content::NotificationDetails& details) { |
| 508 if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) { | 508 if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) { |
| 509 NOTREACHED(); | 509 NOTREACHED(); |
| 510 return; | 510 return; |
| 511 } | 511 } |
| 512 | 512 |
| 513 // If the renderer process attached to this balloon is disconnected | 513 // If the renderer process attached to this balloon is disconnected |
| 514 // (e.g., because of a crash), we want to close the balloon. | 514 // (e.g., because of a crash), we want to close the balloon. |
| 515 notification_registrar_.Remove( | 515 notification_registrar_.Remove( |
| 516 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 516 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
| 517 content::Source<Balloon>(balloon_)); | 517 content::Source<Balloon>(balloon_)); |
| 518 Close(false); | 518 Close(false); |
| 519 } | 519 } |
| OLD | NEW |