Chromium Code Reviews

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

Issue 2811032: Revert 50784 - Canvas refactoring part 3.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/notifications/balloon_view.h" 5 #include "chrome/browser/views/notifications/balloon_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/browser_theme_provider.h" 13 #include "chrome/browser/browser_theme_provider.h"
14 #include "chrome/browser/notifications/balloon.h" 14 #include "chrome/browser/notifications/balloon.h"
15 #include "chrome/browser/notifications/balloon_collection.h" 15 #include "chrome/browser/notifications/balloon_collection.h"
16 #include "chrome/browser/notifications/desktop_notification_service.h" 16 #include "chrome/browser/notifications/desktop_notification_service.h"
17 #include "chrome/browser/profile.h" 17 #include "chrome/browser/profile.h"
18 #include "chrome/browser/renderer_host/render_view_host.h" 18 #include "chrome/browser/renderer_host/render_view_host.h"
19 #include "chrome/browser/renderer_host/render_widget_host_view.h" 19 #include "chrome/browser/renderer_host/render_widget_host_view.h"
20 #include "chrome/browser/views/bubble_border.h" 20 #include "chrome/browser/views/bubble_border.h"
21 #include "chrome/browser/views/notifications/balloon_view_host.h" 21 #include "chrome/browser/views/notifications/balloon_view_host.h"
22 #include "chrome/common/notification_details.h" 22 #include "chrome/common/notification_details.h"
23 #include "chrome/common/notification_source.h" 23 #include "chrome/common/notification_source.h"
24 #include "chrome/common/notification_type.h" 24 #include "chrome/common/notification_type.h"
25 #include "gfx/canvas_skia.h" 25 #include "gfx/canvas.h"
26 #include "gfx/insets.h" 26 #include "gfx/insets.h"
27 #include "gfx/native_widget_types.h" 27 #include "gfx/native_widget_types.h"
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
30 #include "views/controls/button/button.h" 30 #include "views/controls/button/button.h"
31 #include "views/controls/button/image_button.h" 31 #include "views/controls/button/image_button.h"
32 #include "views/controls/button/text_button.h" 32 #include "views/controls/button/text_button.h"
33 #include "views/controls/menu/menu_2.h" 33 #include "views/controls/menu/menu_2.h"
34 #include "views/controls/native/native_view_host.h" 34 #include "views/controls/native/native_view_host.h"
35 #include "views/painter.h" 35 #include "views/painter.h"
(...skipping 423 matching lines...)
459 DCHECK(canvas); 459 DCHECK(canvas);
460 // Paint the menu bar area white, with proper rounded corners. 460 // Paint the menu bar area white, with proper rounded corners.
461 gfx::Path path; 461 gfx::Path path;
462 gfx::Rect rect = GetLocalBounds(false); 462 gfx::Rect rect = GetLocalBounds(false);
463 rect.set_height(GetShelfHeight()); 463 rect.set_height(GetShelfHeight());
464 GetFrameMask(rect, &path); 464 GetFrameMask(rect, &path);
465 465
466 SkPaint paint; 466 SkPaint paint;
467 paint.setAntiAlias(true); 467 paint.setAntiAlias(true);
468 paint.setColor(kControlBarBackgroundColor); 468 paint.setColor(kControlBarBackgroundColor);
469 canvas->AsCanvasSkia()->drawPath(path, paint); 469 canvas->drawPath(path, paint);
470 470
471 // Draw a 1-pixel gray line between the content and the menu bar. 471 // Draw a 1-pixel gray line between the content and the menu bar.
472 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; 472 int line_width = GetTotalWidth() - kLeftMargin - kRightMargin;
473 canvas->FillRectInt(kControlBarSeparatorLineColor, 473 canvas->FillRectInt(kControlBarSeparatorLineColor,
474 kLeftMargin, 1 + GetShelfHeight(), line_width, 1); 474 kLeftMargin, 1 + GetShelfHeight(), line_width, 1);
475 475
476 View::Paint(canvas); 476 View::Paint(canvas);
477 PaintBorder(canvas); 477 PaintBorder(canvas);
478 } 478 }
479 479
(...skipping 33 matching lines...)
513 NOTREACHED(); 513 NOTREACHED();
514 return; 514 return;
515 } 515 }
516 516
517 // If the renderer process attached to this balloon is disconnected 517 // If the renderer process attached to this balloon is disconnected
518 // (e.g., because of a crash), we want to close the balloon. 518 // (e.g., because of a crash), we want to close the balloon.
519 notification_registrar_.Remove(this, 519 notification_registrar_.Remove(this,
520 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); 520 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_));
521 Close(false); 521 Close(false);
522 } 522 }
OLDNEW
« no previous file with comments | « chrome/browser/views/location_bar/location_bar_view.cc ('k') | chrome/browser/views/options/advanced_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine