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 |