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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 DCHECK(canvas); | 467 DCHECK(canvas); |
468 // Paint the menu bar area white, with proper rounded corners. | 468 // Paint the menu bar area white, with proper rounded corners. |
469 gfx::Path path; | 469 gfx::Path path; |
470 gfx::Rect rect = GetContentsBounds(); | 470 gfx::Rect rect = GetContentsBounds(); |
471 rect.set_height(GetShelfHeight()); | 471 rect.set_height(GetShelfHeight()); |
472 GetFrameMask(rect, &path); | 472 GetFrameMask(rect, &path); |
473 | 473 |
474 SkPaint paint; | 474 SkPaint paint; |
475 paint.setAntiAlias(true); | 475 paint.setAntiAlias(true); |
476 paint.setColor(kControlBarBackgroundColor); | 476 paint.setColor(kControlBarBackgroundColor); |
477 canvas->AsCanvasSkia()->drawPath(path, paint); | 477 canvas->AsCanvasSkia()->skia_canvas()->drawPath(path, paint); |
478 | 478 |
479 // Draw a 1-pixel gray line between the content and the menu bar. | 479 // Draw a 1-pixel gray line between the content and the menu bar. |
480 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; | 480 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; |
481 canvas->FillRectInt(kControlBarSeparatorLineColor, | 481 canvas->FillRectInt(kControlBarSeparatorLineColor, |
482 kLeftMargin, 1 + GetShelfHeight(), line_width, 1); | 482 kLeftMargin, 1 + GetShelfHeight(), line_width, 1); |
483 | 483 |
484 View::OnPaint(canvas); | 484 View::OnPaint(canvas); |
485 OnPaintBorder(canvas); | 485 OnPaintBorder(canvas); |
486 } | 486 } |
487 | 487 |
488 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 488 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
489 SizeContentsWindow(); | 489 SizeContentsWindow(); |
490 } | 490 } |
491 | 491 |
492 void BalloonViewImpl::Observe(NotificationType type, | 492 void BalloonViewImpl::Observe(NotificationType type, |
493 const NotificationSource& source, | 493 const NotificationSource& source, |
494 const NotificationDetails& details) { | 494 const NotificationDetails& details) { |
495 if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) { | 495 if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) { |
496 NOTREACHED(); | 496 NOTREACHED(); |
497 return; | 497 return; |
498 } | 498 } |
499 | 499 |
500 // If the renderer process attached to this balloon is disconnected | 500 // If the renderer process attached to this balloon is disconnected |
501 // (e.g., because of a crash), we want to close the balloon. | 501 // (e.g., because of a crash), we want to close the balloon. |
502 notification_registrar_.Remove(this, | 502 notification_registrar_.Remove(this, |
503 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); | 503 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); |
504 Close(false); | 504 Close(false); |
505 } | 505 } |
OLD | NEW |