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

Unified Diff: ui/views/widget/desktop_aura/scoped_tooltip_client.cc

Issue 23477022: Two changes to desktop aura for tooltips: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2013 Created 7 years, 4 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
« no previous file with comments | « ui/views/widget/desktop_aura/scoped_tooltip_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/scoped_tooltip_client.cc
diff --git a/ui/views/widget/desktop_aura/scoped_tooltip_client.cc b/ui/views/widget/desktop_aura/scoped_tooltip_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5b2736af532d0a800f1bdbc7a6f45c99a635191b
--- /dev/null
+++ b/ui/views/widget/desktop_aura/scoped_tooltip_client.cc
@@ -0,0 +1,37 @@
+// Copyright (c) 2013 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/views/widget/desktop_aura/scoped_tooltip_client.h"
+
+#include "ui/aura/root_window.h"
+#include "ui/views/corewm/tooltip_controller.h"
+
+namespace views {
+
+// static
+corewm::TooltipController* ScopedTooltipClient::tooltip_controller_ = NULL;
+
+// static
+int ScopedTooltipClient::scoped_tooltip_client_count_ = 0;
+
+ScopedTooltipClient::ScopedTooltipClient(aura::RootWindow* root_window)
+ : root_window_(root_window) {
+ if (scoped_tooltip_client_count_++ == 0) {
+ tooltip_controller_ =
+ new corewm::TooltipController(gfx::SCREEN_TYPE_NATIVE);
+ }
+ aura::client::SetTooltipClient(root_window_, tooltip_controller_);
+ root_window_->AddPreTargetHandler(tooltip_controller_);
+}
+
+ScopedTooltipClient::~ScopedTooltipClient() {
+ root_window_->RemovePreTargetHandler(tooltip_controller_);
+ aura::client::SetTooltipClient(root_window_, NULL);
+ if (--scoped_tooltip_client_count_ == 0) {
+ delete tooltip_controller_;
+ tooltip_controller_ = NULL;
+ }
+}
+
+} // namespace views
« no previous file with comments | « ui/views/widget/desktop_aura/scoped_tooltip_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698