Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: chrome/browser/ui/views/notifications/balloon_view.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
469 DCHECK(canvas); 469 DCHECK(canvas);
470 // Paint the menu bar area white, with proper rounded corners. 470 // Paint the menu bar area white, with proper rounded corners.
471 gfx::Path path; 471 gfx::Path path;
472 gfx::Rect rect = GetContentsBounds(); 472 gfx::Rect rect = GetContentsBounds();
473 rect.set_height(GetShelfHeight()); 473 rect.set_height(GetShelfHeight());
474 GetFrameMask(rect, &path); 474 GetFrameMask(rect, &path);
475 475
476 SkPaint paint; 476 SkPaint paint;
477 paint.setAntiAlias(true); 477 paint.setAntiAlias(true);
478 paint.setColor(kControlBarBackgroundColor); 478 paint.setColor(kControlBarBackgroundColor);
479 canvas->AsCanvasSkia()->drawPath(path, paint); 479 canvas->GetSkCanvas()->drawPath(path, paint);
480 480
481 // Draw a 1-pixel gray line between the content and the menu bar. 481 // Draw a 1-pixel gray line between the content and the menu bar.
482 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; 482 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin;
483 canvas->FillRectInt(kControlBarSeparatorLineColor, 483 canvas->FillRectInt(kControlBarSeparatorLineColor,
484 kLeftMargin, 1 + GetShelfHeight(), line_width, 1); 484 kLeftMargin, 1 + GetShelfHeight(), line_width, 1);
485 485
486 View::OnPaint(canvas); 486 View::OnPaint(canvas);
487 OnPaintBorder(canvas); 487 OnPaintBorder(canvas);
488 } 488 }
489 489
490 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { 490 void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) {
491 SizeContentsWindow(); 491 SizeContentsWindow();
492 } 492 }
493 493
494 void BalloonViewImpl::Observe(int type, 494 void BalloonViewImpl::Observe(int type,
495 const NotificationSource& source, 495 const NotificationSource& source,
496 const NotificationDetails& details) { 496 const NotificationDetails& details) {
497 if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) { 497 if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) {
498 NOTREACHED(); 498 NOTREACHED();
499 return; 499 return;
500 } 500 }
501 501
502 // If the renderer process attached to this balloon is disconnected 502 // If the renderer process attached to this balloon is disconnected
503 // (e.g., because of a crash), we want to close the balloon. 503 // (e.g., because of a crash), we want to close the balloon.
504 notification_registrar_.Remove( 504 notification_registrar_.Remove(
505 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, 505 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
506 Source<Balloon>(balloon_)); 506 Source<Balloon>(balloon_));
507 Close(false); 507 Close(false);
508 } 508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698