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

Side by Side Diff: ui/wm/public/scoped_tooltip_disabler.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 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
« no previous file with comments | « ui/wm/public/scoped_tooltip_disabler.h ('k') | ui/wm/public/tooltip_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "ui/wm/public/scoped_tooltip_disabler.h"
6
7 #include "ui/aura/window.h"
8 #include "ui/wm/public/tooltip_client.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
« no previous file with comments | « ui/wm/public/scoped_tooltip_disabler.h ('k') | ui/wm/public/tooltip_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698