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

Unified Diff: content/public/browser/host_zoom_map.cc

Issue 12039058: content: convert zoom notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/public/browser/host_zoom_map.cc
diff --git a/content/public/browser/host_zoom_map.cc b/content/public/browser/host_zoom_map.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c38c08bf107bc4f5d32d7cfddb0e8fae9346d316
--- /dev/null
+++ b/content/public/browser/host_zoom_map.cc
@@ -0,0 +1,35 @@
+// 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 "content/public/browser/host_zoom_map.h"
+
+#include "content/browser/host_zoom_map_impl.h"
+
+namespace content {
+
+HostZoomMap::Observer::Observer() : host_zoom_map_(NULL) {
+}
+
+HostZoomMap::Observer::Observer(HostZoomMap* map) : host_zoom_map_(NULL) {
+ Observe(map);
+}
+
+HostZoomMap::Observer::~Observer() {
+ if (host_zoom_map_)
+ host_zoom_map_->RemoveObserver(this);
+}
+
+void HostZoomMap::Observer::Observe(HostZoomMap* map) {
+ if (host_zoom_map_)
+ host_zoom_map_->RemoveObserver(this);
+ host_zoom_map_ = static_cast<HostZoomMapImpl*>(map);
+ host_zoom_map_->AddObserver(this);
+}
+
+void HostZoomMap::Observer::HostZoomMapImplDestroyed() {
+ host_zoom_map_->RemoveObserver(this);
+ host_zoom_map_ = NULL;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698