1 // Copyright 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.
5 #include "ui/wm/public/scoped_tooltip_disabler.h"
7 #include "ui/aura/window.h"
8 #include "ui/wm/public/tooltip_client.h"
13 ScopedTooltipDisabler::ScopedTooltipDisabler(aura::Window
* window
)
14 : root_(window
? window
->GetRootWindow() : NULL
) {
16 root_
->AddObserver(this);
17 TooltipClient
* client
= GetTooltipClient(root_
);
19 client
->SetTooltipsEnabled(false);
23 ScopedTooltipDisabler::~ScopedTooltipDisabler() {
27 void ScopedTooltipDisabler::EnableTooltips() {
30 TooltipClient
* client
= GetTooltipClient(root_
);
32 client
->SetTooltipsEnabled(true);
33 root_
->RemoveObserver(this);
37 void ScopedTooltipDisabler::OnWindowDestroying(aura::Window
* window
) {