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

Side by Side Diff: chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc

Issue 9359052: GTK: Closing in on being completely GSEALed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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/gtk/notifications/balloon_view_gtk.h" 5 #include "chrome/browser/ui/gtk/notifications/balloon_view_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 void BalloonViewImpl::OnCloseButton(GtkWidget* widget) { 408 void BalloonViewImpl::OnCloseButton(GtkWidget* widget) {
409 Close(true); 409 Close(true);
410 } 410 }
411 411
412 // We draw black dots on the bottom left and right corners to fill in the 412 // We draw black dots on the bottom left and right corners to fill in the
413 // border. Otherwise, the border has a gap because the sharp corners of the 413 // border. Otherwise, the border has a gap because the sharp corners of the
414 // HTML view cut off the roundedness of the notification window. 414 // HTML view cut off the roundedness of the notification window.
415 gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender, 415 gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender,
416 GdkEventExpose* event) { 416 GdkEventExpose* event) {
417 TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnContentsExpose"); 417 TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnContentsExpose");
418 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); 418 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(sender));
419 gdk_cairo_rectangle(cr, &event->area); 419 gdk_cairo_rectangle(cr, &event->area);
420 cairo_clip(cr); 420 cairo_clip(cr);
421 421
422 GtkAllocation allocation; 422 GtkAllocation allocation;
423 gtk_widget_get_allocation(sender, &allocation); 423 gtk_widget_get_allocation(sender, &allocation);
424 424
425 // According to a discussion on a mailing list I found, these degenerate 425 // According to a discussion on a mailing list I found, these degenerate
426 // paths are the officially supported way to draw points in Cairo. 426 // paths are the officially supported way to draw points in Cairo.
427 cairo_set_source_rgb(cr, 0, 0, 0); 427 cairo_set_source_rgb(cr, 0, 0, 0);
428 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); 428 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
429 cairo_set_line_width(cr, 1.0); 429 cairo_set_line_width(cr, 1.0);
430 cairo_move_to(cr, 0.5, allocation.height - 0.5); 430 cairo_move_to(cr, 0.5, allocation.height - 0.5);
431 cairo_close_path(cr); 431 cairo_close_path(cr);
432 cairo_move_to(cr, allocation.width - 0.5, allocation.height - 0.5); 432 cairo_move_to(cr, allocation.width - 0.5, allocation.height - 0.5);
433 cairo_close_path(cr); 433 cairo_close_path(cr);
434 cairo_stroke(cr); 434 cairo_stroke(cr);
435 cairo_destroy(cr); 435 cairo_destroy(cr);
436 436
437 return FALSE; 437 return FALSE;
438 } 438 }
439 439
440 gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) { 440 gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) {
441 TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnExpose"); 441 TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnExpose");
442 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); 442 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(sender));
443 gdk_cairo_rectangle(cr, &event->area); 443 gdk_cairo_rectangle(cr, &event->area);
444 cairo_clip(cr); 444 cairo_clip(cr);
445 445
446 gfx::Size content_size = balloon_->content_size(); 446 gfx::Size content_size = balloon_->content_size();
447 gfx::Point offset = GetContentsOffset(); 447 gfx::Point offset = GetContentsOffset();
448 448
449 // Draw a background color behind the shelf. 449 // Draw a background color behind the shelf.
450 cairo_set_source_rgb(cr, kShelfBackgroundColorR, 450 cairo_set_source_rgb(cr, kShelfBackgroundColorR,
451 kShelfBackgroundColorG, kShelfBackgroundColorB); 451 kShelfBackgroundColorG, kShelfBackgroundColorB);
452 cairo_rectangle(cr, kLeftMargin, kTopMargin + 0.5, 452 cairo_rectangle(cr, kLeftMargin, kTopMargin + 0.5,
(...skipping 29 matching lines...) Expand all
482 weak_factory_.GetWeakPtr(), 482 weak_factory_.GetWeakPtr(),
483 false)); 483 false));
484 } 484 }
485 } 485 }
486 486
487 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { 487 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) {
488 frame_container_ = NULL; 488 frame_container_ = NULL;
489 Close(false); 489 Close(false);
490 return FALSE; // Propagate. 490 return FALSE; // Propagate.
491 } 491 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698