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

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

Issue 8800029: GTK: Add TRACE_EVENTs around gtk ui events. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase again for ANOTHER conflict Created 9 years 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
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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/debug/trace_event.h"
13 #include "base/message_loop.h" 14 #include "base/message_loop.h"
14 #include "base/string_util.h" 15 #include "base/string_util.h"
15 #include "chrome/browser/extensions/extension_host.h" 16 #include "chrome/browser/extensions/extension_host.h"
16 #include "chrome/browser/extensions/extension_process_manager.h" 17 #include "chrome/browser/extensions/extension_process_manager.h"
17 #include "chrome/browser/notifications/balloon.h" 18 #include "chrome/browser/notifications/balloon.h"
18 #include "chrome/browser/notifications/desktop_notification_service.h" 19 #include "chrome/browser/notifications/desktop_notification_service.h"
19 #include "chrome/browser/notifications/notification.h" 20 #include "chrome/browser/notifications/notification.h"
20 #include "chrome/browser/notifications/notification_options_menu_model.h" 21 #include "chrome/browser/notifications/notification_options_menu_model.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/themes/theme_service.h" 23 #include "chrome/browser/themes/theme_service.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 407
407 void BalloonViewImpl::OnCloseButton(GtkWidget* widget) { 408 void BalloonViewImpl::OnCloseButton(GtkWidget* widget) {
408 Close(true); 409 Close(true);
409 } 410 }
410 411
411 // 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
412 // 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
413 // HTML view cut off the roundedness of the notification window. 414 // HTML view cut off the roundedness of the notification window.
414 gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender, 415 gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender,
415 GdkEventExpose* event) { 416 GdkEventExpose* event) {
417 TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnContentsExpose");
416 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); 418 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
417 gdk_cairo_rectangle(cr, &event->area); 419 gdk_cairo_rectangle(cr, &event->area);
418 cairo_clip(cr); 420 cairo_clip(cr);
419 421
420 GtkAllocation allocation; 422 GtkAllocation allocation;
421 gtk_widget_get_allocation(sender, &allocation); 423 gtk_widget_get_allocation(sender, &allocation);
422 424
423 // 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
424 // paths are the officially supported way to draw points in Cairo. 426 // paths are the officially supported way to draw points in Cairo.
425 cairo_set_source_rgb(cr, 0, 0, 0); 427 cairo_set_source_rgb(cr, 0, 0, 0);
426 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); 428 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
427 cairo_set_line_width(cr, 1.0); 429 cairo_set_line_width(cr, 1.0);
428 cairo_move_to(cr, 0.5, allocation.height - 0.5); 430 cairo_move_to(cr, 0.5, allocation.height - 0.5);
429 cairo_close_path(cr); 431 cairo_close_path(cr);
430 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);
431 cairo_close_path(cr); 433 cairo_close_path(cr);
432 cairo_stroke(cr); 434 cairo_stroke(cr);
433 cairo_destroy(cr); 435 cairo_destroy(cr);
434 436
435 return FALSE; 437 return FALSE;
436 } 438 }
437 439
438 gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) { 440 gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) {
441 TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnExpose");
439 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); 442 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
440 gdk_cairo_rectangle(cr, &event->area); 443 gdk_cairo_rectangle(cr, &event->area);
441 cairo_clip(cr); 444 cairo_clip(cr);
442 445
443 gfx::Size content_size = balloon_->content_size(); 446 gfx::Size content_size = balloon_->content_size();
444 gfx::Point offset = GetContentsOffset(); 447 gfx::Point offset = GetContentsOffset();
445 448
446 // Draw a background color behind the shelf. 449 // Draw a background color behind the shelf.
447 cairo_set_source_rgb(cr, kShelfBackgroundColorR, 450 cairo_set_source_rgb(cr, kShelfBackgroundColorR,
448 kShelfBackgroundColorG, kShelfBackgroundColorB); 451 kShelfBackgroundColorG, kShelfBackgroundColorB);
(...skipping 30 matching lines...) Expand all
479 weak_factory_.GetWeakPtr(), 482 weak_factory_.GetWeakPtr(),
480 false)); 483 false));
481 } 484 }
482 } 485 }
483 486
484 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { 487 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) {
485 frame_container_ = NULL; 488 frame_container_ = NULL;
486 Close(false); 489 Close(false);
487 return FALSE; // Propagate. 490 return FALSE; // Propagate.
488 } 491 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/ui/gtk/reload_button_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698