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

Side by Side Diff: ash/shelf/shelf_tooltip_manager.cc

Issue 1640503002: ash: Do not use MessageLoopForUI when not needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/shelf/shelf_tooltip_manager.h" 5 #include "ash/shelf/shelf_tooltip_manager.h"
6 6
7 #include "ash/shelf/shelf_layout_manager.h" 7 #include "ash/shelf/shelf_layout_manager.h"
8 #include "ash/shelf/shelf_view.h" 8 #include "ash/shelf/shelf_view.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/window_animations.h" 11 #include "ash/wm/window_animations.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/aura/window_event_dispatcher.h" 17 #include "ui/aura/window_event_dispatcher.h"
18 #include "ui/events/event.h" 18 #include "ui/events/event.h"
19 #include "ui/events/event_constants.h" 19 #include "ui/events/event_constants.h"
20 #include "ui/gfx/geometry/insets.h" 20 #include "ui/gfx/geometry/insets.h"
21 #include "ui/views/bubble/bubble_delegate.h" 21 #include "ui/views/bubble/bubble_delegate.h"
22 #include "ui/views/bubble/bubble_frame_view.h" 22 #include "ui/views/bubble/bubble_frame_view.h"
23 #include "ui/views/controls/label.h" 23 #include "ui/views/controls/label.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 void ShelfTooltipManager::CancelHidingAnimation() { 319 void ShelfTooltipManager::CancelHidingAnimation() {
320 if (!widget_ || !widget_->GetNativeView()) 320 if (!widget_ || !widget_->GetNativeView())
321 return; 321 return;
322 322
323 gfx::NativeView native_view = widget_->GetNativeView(); 323 gfx::NativeView native_view = widget_->GetNativeView();
324 wm::SetWindowVisibilityAnimationTransition( 324 wm::SetWindowVisibilityAnimationTransition(
325 native_view, wm::ANIMATE_NONE); 325 native_view, wm::ANIMATE_NONE);
326 } 326 }
327 327
328 void ShelfTooltipManager::CloseSoon() { 328 void ShelfTooltipManager::CloseSoon() {
329 base::MessageLoopForUI::current()->PostTask( 329 base::ThreadTaskRunnerHandle::Get()->PostTask(
330 FROM_HERE, 330 FROM_HERE,
331 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); 331 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr()));
332 } 332 }
333 333
334 void ShelfTooltipManager::ShowInternal() { 334 void ShelfTooltipManager::ShowInternal() {
335 if (view_) 335 if (view_)
336 view_->GetWidget()->Show(); 336 view_->GetWidget()->Show();
337 337
338 timer_.reset(); 338 timer_.reset();
339 } 339 }
(...skipping 25 matching lines...) Expand all
365 void ShelfTooltipManager::CreateTimer(int delay_in_ms) { 365 void ShelfTooltipManager::CreateTimer(int delay_in_ms) {
366 base::OneShotTimer* new_timer = new base::OneShotTimer(); 366 base::OneShotTimer* new_timer = new base::OneShotTimer();
367 new_timer->Start(FROM_HERE, 367 new_timer->Start(FROM_HERE,
368 base::TimeDelta::FromMilliseconds(delay_in_ms), 368 base::TimeDelta::FromMilliseconds(delay_in_ms),
369 this, 369 this,
370 &ShelfTooltipManager::ShowInternal); 370 &ShelfTooltipManager::ShowInternal);
371 timer_.reset(new_timer); 371 timer_.reset(new_timer);
372 } 372 }
373 373
374 } // namespace ash 374 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698