| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 return gfx::Rect(frame_rect.x() + offset.x(), | 469 return gfx::Rect(frame_rect.x() + offset.x(), |
| 470 frame_rect.y() + GetShelfHeight() + offset.y(), | 470 frame_rect.y() + GetShelfHeight() + offset.y(), |
| 471 content_size.width(), | 471 content_size.width(), |
| 472 content_size.height()); | 472 content_size.height()); |
| 473 } | 473 } |
| 474 | 474 |
| 475 void BalloonViewImpl::Paint(gfx::Canvas* canvas) { | 475 void BalloonViewImpl::Paint(gfx::Canvas* canvas) { |
| 476 DCHECK(canvas); | 476 DCHECK(canvas); |
| 477 // Paint the menu bar area white, with proper rounded corners. | 477 // Paint the menu bar area white, with proper rounded corners. |
| 478 gfx::Path path; | 478 gfx::Path path; |
| 479 gfx::Rect rect = GetLocalBounds(); | 479 gfx::Rect rect = GetContentsBounds(); |
| 480 rect.set_height(GetShelfHeight()); | 480 rect.set_height(GetShelfHeight()); |
| 481 GetFrameMask(rect, &path); | 481 GetFrameMask(rect, &path); |
| 482 | 482 |
| 483 SkPaint paint; | 483 SkPaint paint; |
| 484 paint.setAntiAlias(true); | 484 paint.setAntiAlias(true); |
| 485 paint.setColor(kControlBarBackgroundColor); | 485 paint.setColor(kControlBarBackgroundColor); |
| 486 canvas->AsCanvasSkia()->drawPath(path, paint); | 486 canvas->AsCanvasSkia()->drawPath(path, paint); |
| 487 | 487 |
| 488 // Draw a 1-pixel gray line between the content and the menu bar. | 488 // Draw a 1-pixel gray line between the content and the menu bar. |
| 489 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; | 489 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 501 NOTREACHED(); | 501 NOTREACHED(); |
| 502 return; | 502 return; |
| 503 } | 503 } |
| 504 | 504 |
| 505 // If the renderer process attached to this balloon is disconnected | 505 // If the renderer process attached to this balloon is disconnected |
| 506 // (e.g., because of a crash), we want to close the balloon. | 506 // (e.g., because of a crash), we want to close the balloon. |
| 507 notification_registrar_.Remove(this, | 507 notification_registrar_.Remove(this, |
| 508 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); | 508 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); |
| 509 Close(false); | 509 Close(false); |
| 510 } | 510 } |
| OLD | NEW |