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

Side by Side Diff: content/browser/host_zoom_level_context.h

Issue 393133002: Migrate HostZoomMap to live in StoragePartition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments; patch for landing. Created 6 years, 1 month 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 | Annotate | Revision Log
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 #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 "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/browser/host_zoom_map_impl.h"
12 #include "content/public/browser/zoom_level_delegate.h"
13
14 class PrefService;
15
16 namespace content {
17 struct HostZoomLevelContextDeleter;
18
19 // This class manages a HostZoomMap and associates it with a ZoomLevelDelegate,
20 // if one is provided. It also serves to keep the zoom level machinery details
21 // separate from the owning StoragePartitionImpl.
22 class HostZoomLevelContext
23 : public base::RefCountedThreadSafe<HostZoomLevelContext,
24 HostZoomLevelContextDeleter> {
25 public:
26 explicit HostZoomLevelContext(
27 scoped_ptr<ZoomLevelDelegate> zoom_level_delegate);
28
29 HostZoomMap* GetHostZoomMap() const { return host_zoom_map_impl_.get(); }
30 ZoomLevelDelegate* GetZoomLevelDelegate() const {
31 return zoom_level_delegate_.get();
32 }
33
34 protected:
35 virtual ~HostZoomLevelContext();
36
37 private:
38 friend class base::DeleteHelper<HostZoomLevelContext>;
39 friend class base::RefCountedThreadSafe<HostZoomLevelContext,
40 HostZoomLevelContextDeleter>;
41 friend struct HostZoomLevelContextDeleter;
42
43 void DeleteOnCorrectThread() const;
44
45 scoped_ptr<HostZoomMapImpl> host_zoom_map_impl_;
46 // Release the delegate before the HostZoomMap, in case it is carrying
47 // any HostZoomMap::Subscription pointers.
48 scoped_ptr<ZoomLevelDelegate> zoom_level_delegate_;
49
50 DISALLOW_COPY_AND_ASSIGN(HostZoomLevelContext);
51 };
52
53 struct HostZoomLevelContextDeleter {
54 static void Destruct(const HostZoomLevelContext* context) {
55 context->DeleteOnCorrectThread();
56 }
57 };
58
59 } // namespace content
60
61 #endif // CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl_unittest.cc ('k') | content/browser/host_zoom_level_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698