OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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 #ifndef CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "content/browser/host_zoom_map_impl.h" |
| 10 #include "content/public/browser/zoom_level_prefs_store.h" |
| 11 |
| 12 class PrefService; |
| 13 |
| 14 namespace base { |
| 15 class FilePath; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 // This class manages a HostZoomMap and, associates it with a PrefsStore, |
| 21 // if one is provided. It also serves to keep the zoom level machinery details |
| 22 // deparate from the owning StoragePartitionImpl. |
| 23 class HostZoomLevelContext { |
| 24 public: |
| 25 HostZoomLevelContext(scoped_ptr<ZoomLevelPrefsStore> zoom_level_prefs, |
| 26 const base::FilePath& file_path); |
| 27 ~HostZoomLevelContext(); |
| 28 |
| 29 HostZoomMap* GetHostZoomMap() const { return host_zoom_map_impl_.get(); } |
| 30 PrefService* GetZoomLevelPrefs() { |
| 31 return zoom_level_prefs_ ? zoom_level_prefs_->GetPrefs() : NULL; |
| 32 } |
| 33 |
| 34 private: |
| 35 scoped_ptr<HostZoomMapImpl> host_zoom_map_impl_; |
| 36 // The prefs_store pointer needs to be released before the destructor for the |
| 37 // HostZoomMapImpl is called, and so must be declared in this order. |
| 38 scoped_ptr<ZoomLevelPrefsStore> zoom_level_prefs_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(HostZoomLevelContext); |
| 41 }; |
| 42 |
| 43 } // namespace content |
| 44 |
| 45 #endif // CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_ |
OLD | NEW |