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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/aura/client/scoped_tooltip_disabler.h"
6
7 #include "ui/aura/client/tooltip_client.h"
8 #include "ui/aura/window.h"
9
10 namespace aura {
11 namespace client {
12
13 ScopedTooltipDisabler::ScopedTooltipDisabler(aura::Window* window)
14 : root_(window ? window->GetRootWindow() : NULL) {
15 if (root_) {
16 root_->AddObserver(this);
17 TooltipClient* client = GetTooltipClient(root_);
18 if (client)
19 client->SetTooltipsEnabled(false);
20 }
21 }
22
23 ScopedTooltipDisabler::~ScopedTooltipDisabler() {
24 EnableTooltips();
25 }
26
27 void ScopedTooltipDisabler::EnableTooltips() {
28 if (!root_)
29 return;
30 TooltipClient* client = GetTooltipClient(root_);
31 if (client)
32 client->SetTooltipsEnabled(true);
33 root_->RemoveObserver(this);
34 root_ = NULL;
35 }
36
37 void ScopedTooltipDisabler::OnWindowDestroying(aura::Window* window) {
38 EnableTooltips();
39 }
40
41
42 } // namespace client
43 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698