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

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

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
« no previous file with comments | « chrome/browser/ui/gtk/menu_gtk.cc ('k') | chrome/browser/ui/gtk/one_click_signin_bubble_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 frame_container_ = NULL; 116 frame_container_ = NULL;
117 gtk_widget_hide(widget); 117 gtk_widget_hide(widget);
118 } 118 }
119 } 119 }
120 120
121 void BalloonViewImpl::Close(bool by_user) { 121 void BalloonViewImpl::Close(bool by_user) {
122 // Delay a system-initiated close if the menu is showing. 122 // Delay a system-initiated close if the menu is showing.
123 if (!by_user && menu_showing_) { 123 if (!by_user && menu_showing_) {
124 pending_close_ = true; 124 pending_close_ = true;
125 } else { 125 } else {
126 MessageLoop::current()->PostTask( 126 base::MessageLoop::current()->PostTask(
127 FROM_HERE, 127 FROM_HERE,
128 base::Bind(&BalloonViewImpl::DelayedClose, 128 base::Bind(&BalloonViewImpl::DelayedClose,
129 weak_factory_.GetWeakPtr(), 129 weak_factory_.GetWeakPtr(),
130 by_user)); 130 by_user));
131 } 131 }
132 } 132 }
133 133
134 gfx::Size BalloonViewImpl::GetSize() const { 134 gfx::Size BalloonViewImpl::GetSize() const {
135 // BalloonView has no size if it hasn't been shown yet (which is when 135 // BalloonView has no size if it hasn't been shown yet (which is when
136 // balloon_ is set). 136 // balloon_ is set).
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 void BalloonViewImpl::OnOptionsMenuButton(GtkWidget* widget, 460 void BalloonViewImpl::OnOptionsMenuButton(GtkWidget* widget,
461 GdkEventButton* event) { 461 GdkEventButton* event) {
462 menu_showing_ = true; 462 menu_showing_ = true;
463 options_menu_->PopupForWidget(widget, event->button, event->time); 463 options_menu_->PopupForWidget(widget, event->button, event->time);
464 } 464 }
465 465
466 // Called when the menu stops showing. 466 // Called when the menu stops showing.
467 void BalloonViewImpl::StoppedShowing() { 467 void BalloonViewImpl::StoppedShowing() {
468 menu_showing_ = false; 468 menu_showing_ = false;
469 if (pending_close_) { 469 if (pending_close_) {
470 MessageLoop::current()->PostTask( 470 base::MessageLoop::current()->PostTask(
471 FROM_HERE, 471 FROM_HERE,
472 base::Bind(&BalloonViewImpl::DelayedClose, 472 base::Bind(
473 weak_factory_.GetWeakPtr(), 473 &BalloonViewImpl::DelayedClose, weak_factory_.GetWeakPtr(), false));
474 false));
475 } 474 }
476 } 475 }
477 476
478 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { 477 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) {
479 frame_container_ = NULL; 478 frame_container_ = NULL;
480 Close(false); 479 Close(false);
481 return FALSE; // Propagate. 480 return FALSE; // Propagate.
482 } 481 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/menu_gtk.cc ('k') | chrome/browser/ui/gtk/one_click_signin_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698