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

Side by Side Diff: ash/tooltips/tooltip_controller.cc

Issue 10442017: Rename GetRootWindow() -> GetPrimaryRootWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-try -b linux_chromeos,win_aura Created 8 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 | « ash/test/ash_test_base.cc ('k') | ash/tooltips/tooltip_controller_unittest.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 "ash/tooltips/tooltip_controller.h" 5 #include "ash/tooltips/tooltip_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 TooltipController::TooltipController() 180 TooltipController::TooltipController()
181 : tooltip_window_(NULL), 181 : tooltip_window_(NULL),
182 tooltip_window_at_mouse_press_(NULL), 182 tooltip_window_at_mouse_press_(NULL),
183 mouse_pressed_(false), 183 mouse_pressed_(false),
184 tooltip_(new Tooltip), 184 tooltip_(new Tooltip),
185 tooltips_enabled_(true) { 185 tooltips_enabled_(true) {
186 tooltip_timer_.Start(FROM_HERE, 186 tooltip_timer_.Start(FROM_HERE,
187 base::TimeDelta::FromMilliseconds(kTooltipTimeoutMs), 187 base::TimeDelta::FromMilliseconds(kTooltipTimeoutMs),
188 this, &TooltipController::TooltipTimerFired); 188 this, &TooltipController::TooltipTimerFired);
189 aura::client::SetTooltipClient(Shell::GetRootWindow(), this); 189 aura::client::SetTooltipClient(Shell::GetPrimaryRootWindow(), this);
190 } 190 }
191 191
192 TooltipController::~TooltipController() { 192 TooltipController::~TooltipController() {
193 if (tooltip_window_) 193 if (tooltip_window_)
194 tooltip_window_->RemoveObserver(this); 194 tooltip_window_->RemoveObserver(this);
195 } 195 }
196 196
197 void TooltipController::UpdateTooltip(aura::Window* target) { 197 void TooltipController::UpdateTooltip(aura::Window* target) {
198 // If tooltip is visible, we may want to hide it. If it is not, we are ok. 198 // If tooltip is visible, we may want to hide it. If it is not, we are ok.
199 if (tooltip_window_ == target && tooltip_->IsVisible()) 199 if (tooltip_window_ == target && tooltip_->IsVisible())
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 *text = result; 367 *text = result;
368 } 368 }
369 369
370 void TooltipController::TooltipTimerFired() { 370 void TooltipController::TooltipTimerFired() {
371 UpdateIfRequired(); 371 UpdateIfRequired();
372 } 372 }
373 373
374 void TooltipController::UpdateIfRequired() { 374 void TooltipController::UpdateIfRequired() {
375 if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() || 375 if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() ||
376 !Shell::GetRootWindow()->cursor_shown()) { 376 !Shell::GetPrimaryRootWindow()->cursor_shown()) {
377 tooltip_->Hide(); 377 tooltip_->Hide();
378 return; 378 return;
379 } 379 }
380 380
381 string16 tooltip_text; 381 string16 tooltip_text;
382 if (tooltip_window_) 382 if (tooltip_window_)
383 tooltip_text = aura::client::GetTooltipText(tooltip_window_); 383 tooltip_text = aura::client::GetTooltipText(tooltip_window_);
384 384
385 // If the user pressed a mouse button. We will hide the tooltip and not show 385 // If the user pressed a mouse button. We will hide the tooltip and not show
386 // it until there is a change in the tooltip. 386 // it until there is a change in the tooltip.
(...skipping 25 matching lines...) Expand all
412 } 412 }
413 } 413 }
414 } 414 }
415 415
416 bool TooltipController::IsTooltipVisible() { 416 bool TooltipController::IsTooltipVisible() {
417 return tooltip_->IsVisible(); 417 return tooltip_->IsVisible();
418 } 418 }
419 419
420 bool TooltipController::IsDragDropInProgress() { 420 bool TooltipController::IsDragDropInProgress() {
421 aura::client::DragDropClient* client = aura::client::GetDragDropClient( 421 aura::client::DragDropClient* client = aura::client::GetDragDropClient(
422 Shell::GetRootWindow()); 422 Shell::GetPrimaryRootWindow());
423 if (client) 423 if (client)
424 return client->IsDragDropInProgress(); 424 return client->IsDragDropInProgress();
425 return false; 425 return false;
426 } 426 }
427 427
428 } // namespace internal 428 } // namespace internal
429 } // namespace ash 429 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.cc ('k') | ash/tooltips/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698