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

Unified Diff: ui/aura/client/scoped_tooltip_disabler.cc

Issue 109403008: Disables showing tooltips while a system menu is showing on windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move resetting Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/client/scoped_tooltip_disabler.cc
diff --git a/ui/aura/client/scoped_tooltip_disabler.cc b/ui/aura/client/scoped_tooltip_disabler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7bed75f89c75bcdf86ab8bbbaa9ef975bdd8a90b
--- /dev/null
+++ b/ui/aura/client/scoped_tooltip_disabler.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/aura/client/scoped_tooltip_disabler.h"
+
+#include "ui/aura/client/tooltip_client.h"
+#include "ui/aura/window.h"
+
+namespace aura {
+namespace client {
+
+ScopedTooltipDisabler::ScopedTooltipDisabler(aura::Window* window)
+ : root_(window ? window->GetRootWindow() : NULL) {
+ if (root_) {
+ root_->AddObserver(this);
+ TooltipClient* client = GetTooltipClient(root_);
+ if (client)
+ client->SetTooltipsEnabled(false);
+ }
+}
+
+ScopedTooltipDisabler::~ScopedTooltipDisabler() {
+ EnableTooltips();
+}
+
+void ScopedTooltipDisabler::EnableTooltips() {
+ if (!root_)
+ return;
+ TooltipClient* client = GetTooltipClient(root_);
+ if (client)
+ client->SetTooltipsEnabled(true);
+ root_->RemoveObserver(this);
+ root_ = NULL;
+}
+
+void ScopedTooltipDisabler::OnWindowDestroying(aura::Window* window) {
+ EnableTooltips();
+}
+
+
+} // namespace client
+} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698