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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « content/browser/gpu/shader_disk_cache.cc ('k') | content/browser/host_zoom_level_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_
6 #define CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_ 6 #define CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #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/browser/host_zoom_map_impl.h"
12 #include "content/public/browser/zoom_level_delegate.h" 13 #include "content/public/browser/zoom_level_delegate.h"
13 14
14 class PrefService; 15 class PrefService;
15 16
16 namespace content { 17 namespace content {
17 struct HostZoomLevelContextDeleter; 18 struct HostZoomLevelContextDeleter;
18 19
19 // This class manages a HostZoomMap and associates it with a ZoomLevelDelegate, 20 // 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 // if one is provided. It also serves to keep the zoom level machinery details
21 // separate from the owning StoragePartitionImpl. 22 // separate from the owning StoragePartitionImpl.
22 class HostZoomLevelContext 23 class HostZoomLevelContext
23 : public base::RefCountedThreadSafe<HostZoomLevelContext, 24 : public base::RefCountedThreadSafe<HostZoomLevelContext,
24 HostZoomLevelContextDeleter> { 25 HostZoomLevelContextDeleter> {
25 public: 26 public:
26 explicit HostZoomLevelContext( 27 explicit HostZoomLevelContext(
27 scoped_ptr<ZoomLevelDelegate> zoom_level_delegate); 28 std::unique_ptr<ZoomLevelDelegate> zoom_level_delegate);
28 29
29 HostZoomMap* GetHostZoomMap() const { return host_zoom_map_impl_.get(); } 30 HostZoomMap* GetHostZoomMap() const { return host_zoom_map_impl_.get(); }
30 ZoomLevelDelegate* GetZoomLevelDelegate() const { 31 ZoomLevelDelegate* GetZoomLevelDelegate() const {
31 return zoom_level_delegate_.get(); 32 return zoom_level_delegate_.get();
32 } 33 }
33 34
34 protected: 35 protected:
35 virtual ~HostZoomLevelContext(); 36 virtual ~HostZoomLevelContext();
36 37
37 private: 38 private:
38 friend class base::DeleteHelper<HostZoomLevelContext>; 39 friend class base::DeleteHelper<HostZoomLevelContext>;
39 friend class base::RefCountedThreadSafe<HostZoomLevelContext, 40 friend class base::RefCountedThreadSafe<HostZoomLevelContext,
40 HostZoomLevelContextDeleter>; 41 HostZoomLevelContextDeleter>;
41 friend struct HostZoomLevelContextDeleter; 42 friend struct HostZoomLevelContextDeleter;
42 43
43 void DeleteOnCorrectThread() const; 44 void DeleteOnCorrectThread() const;
44 45
45 scoped_ptr<HostZoomMapImpl> host_zoom_map_impl_; 46 std::unique_ptr<HostZoomMapImpl> host_zoom_map_impl_;
46 // Release the delegate before the HostZoomMap, in case it is carrying 47 // Release the delegate before the HostZoomMap, in case it is carrying
47 // any HostZoomMap::Subscription pointers. 48 // any HostZoomMap::Subscription pointers.
48 scoped_ptr<ZoomLevelDelegate> zoom_level_delegate_; 49 std::unique_ptr<ZoomLevelDelegate> zoom_level_delegate_;
49 50
50 DISALLOW_COPY_AND_ASSIGN(HostZoomLevelContext); 51 DISALLOW_COPY_AND_ASSIGN(HostZoomLevelContext);
51 }; 52 };
52 53
53 struct HostZoomLevelContextDeleter { 54 struct HostZoomLevelContextDeleter {
54 static void Destruct(const HostZoomLevelContext* context) { 55 static void Destruct(const HostZoomLevelContext* context) {
55 context->DeleteOnCorrectThread(); 56 context->DeleteOnCorrectThread();
56 } 57 }
57 }; 58 };
58 59
59 } // namespace content 60 } // namespace content
60 61
61 #endif // CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_ 62 #endif // CONTENT_BROWSER_HOST_ZOOM_LEVEL_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/shader_disk_cache.cc ('k') | content/browser/host_zoom_level_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698