This source file includes following definitions.
- EnableTooltips
- OnWindowDestroying
#include "ui/wm/public/scoped_tooltip_disabler.h"
#include "ui/aura/window.h"
#include "ui/wm/public/tooltip_client.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();
}
}
}