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

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

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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 "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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // want to update the tooltip because the timer has fired. 443 // want to update the tooltip because the timer has fired.
444 // If we come here from UpdateTooltip(), we have already checked for tooltip 444 // If we come here from UpdateTooltip(), we have already checked for tooltip
445 // visibility and this check below will have no effect. 445 // visibility and this check below will have no effect.
446 if (tooltip_text_ != tooltip_text || !GetTooltip()->IsVisible()) { 446 if (tooltip_text_ != tooltip_text || !GetTooltip()->IsVisible()) {
447 tooltip_shown_timer_.Stop(); 447 tooltip_shown_timer_.Stop();
448 tooltip_text_ = tooltip_text; 448 tooltip_text_ = tooltip_text;
449 if (tooltip_text_.empty()) { 449 if (tooltip_text_.empty()) {
450 GetTooltip()->Hide(); 450 GetTooltip()->Hide();
451 } else { 451 } else {
452 string16 tooltip_text(tooltip_text_); 452 string16 tooltip_text(tooltip_text_);
453 gfx::Point widget_loc = curr_mouse_loc_; 453 gfx::Point widget_loc = curr_mouse_loc_;
Peter Kasting 2012/10/27 01:01:39 Nit: Inline both of these statements into the SetT
danakj 2012/10/29 19:17:20 Done.
454 widget_loc = widget_loc.Add( 454 widget_loc = widget_loc.Add(
455 tooltip_window_->GetBoundsInScreen().origin()); 455 tooltip_window_->GetBoundsInScreen().OffsetFromOrigin());
Peter Kasting 2012/10/27 01:01:39 Can we replace GetBoundsInScreen() with a function
danakj 2012/10/29 19:17:20 I don't think we want to replace the method. There
456 GetTooltip()->SetText(tooltip_text, widget_loc); 456 GetTooltip()->SetText(tooltip_text, widget_loc);
457 GetTooltip()->Show(); 457 GetTooltip()->Show();
458 tooltip_shown_timer_.Start(FROM_HERE, 458 tooltip_shown_timer_.Start(FROM_HERE,
459 base::TimeDelta::FromMilliseconds(kTooltipShownTimeoutMs), 459 base::TimeDelta::FromMilliseconds(kTooltipShownTimeoutMs),
460 this, &TooltipController::TooltipShownTimerFired); 460 this, &TooltipController::TooltipShownTimerFired);
461 } 461 }
462 } 462 }
463 } 463 }
464 464
465 bool TooltipController::IsTooltipVisible() { 465 bool TooltipController::IsTooltipVisible() {
466 return GetTooltip()->IsVisible(); 466 return GetTooltip()->IsVisible();
467 } 467 }
468 468
469 bool TooltipController::IsDragDropInProgress() { 469 bool TooltipController::IsDragDropInProgress() {
470 return drag_drop_client_->IsDragDropInProgress(); 470 return drag_drop_client_->IsDragDropInProgress();
471 } 471 }
472 472
473 TooltipController::Tooltip* TooltipController::GetTooltip() { 473 TooltipController::Tooltip* TooltipController::GetTooltip() {
474 if (!tooltip_.get()) 474 if (!tooltip_.get())
475 tooltip_.reset(new Tooltip); 475 tooltip_.reset(new Tooltip);
476 return tooltip_.get(); 476 return tooltip_.get();
477 } 477 }
478 478
479 } // namespace internal 479 } // namespace internal
480 } // namespace ash 480 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698