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

Side by Side Diff: chrome/browser/ui/gtk/download/download_shelf_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
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/download/download_shelf_gtk.h" 5 #include "chrome/browser/ui/gtk/download/download_shelf_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/download/download_item_model.h" 10 #include "chrome/browser/download/download_item_model.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 AutoCloseIfPossible(); 332 AutoCloseIfPossible();
333 } 333 }
334 334
335 void DownloadShelfGtk::SetCloseOnMouseOut(bool close) { 335 void DownloadShelfGtk::SetCloseOnMouseOut(bool close) {
336 if (close_on_mouse_out_ == close) 336 if (close_on_mouse_out_ == close)
337 return; 337 return;
338 338
339 close_on_mouse_out_ = close; 339 close_on_mouse_out_ = close;
340 mouse_in_shelf_ = close; 340 mouse_in_shelf_ = close;
341 if (close) 341 if (close)
342 MessageLoopForUI::current()->AddObserver(this); 342 base::MessageLoopForUI::current()->AddObserver(this);
343 else 343 else
344 MessageLoopForUI::current()->RemoveObserver(this); 344 base::MessageLoopForUI::current()->RemoveObserver(this);
345 } 345 }
346 346
347 void DownloadShelfGtk::WillProcessEvent(GdkEvent* event) { 347 void DownloadShelfGtk::WillProcessEvent(GdkEvent* event) {
348 } 348 }
349 349
350 void DownloadShelfGtk::DidProcessEvent(GdkEvent* event) { 350 void DownloadShelfGtk::DidProcessEvent(GdkEvent* event) {
351 gfx::Point cursor_screen_coords; 351 gfx::Point cursor_screen_coords;
352 352
353 switch (event->type) { 353 switch (event->type) {
354 case GDK_MOTION_NOTIFY: 354 case GDK_MOTION_NOTIFY:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // Negative insets expand the rectangle. We only expand the top. 388 // Negative insets expand the rectangle. We only expand the top.
389 bounds.Inset(gfx::Insets(-kShelfAuraSize, 0, 0, 0)); 389 bounds.Inset(gfx::Insets(-kShelfAuraSize, 0, 0, 0));
390 390
391 return bounds.Contains(cursor_screen_coords); 391 return bounds.Contains(cursor_screen_coords);
392 } 392 }
393 393
394 void DownloadShelfGtk::MouseLeftShelf() { 394 void DownloadShelfGtk::MouseLeftShelf() {
395 DCHECK(close_on_mouse_out_); 395 DCHECK(close_on_mouse_out_);
396 396
397 MessageLoop::current()->PostDelayedTask( 397 base::MessageLoop::current()->PostDelayedTask(
398 FROM_HERE, 398 FROM_HERE,
399 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr(), 399 base::Bind(
400 AUTOMATIC), 400 &DownloadShelfGtk::Close, weak_factory_.GetWeakPtr(), AUTOMATIC),
401 base::TimeDelta::FromMilliseconds(kAutoCloseDelayMs)); 401 base::TimeDelta::FromMilliseconds(kAutoCloseDelayMs));
402 } 402 }
403 403
404 void DownloadShelfGtk::MouseEnteredShelf() { 404 void DownloadShelfGtk::MouseEnteredShelf() {
405 weak_factory_.InvalidateWeakPtrs(); 405 weak_factory_.InvalidateWeakPtrs();
406 } 406 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/download/download_shelf_gtk.h ('k') | chrome/browser/ui/gtk/download/download_started_animation_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698