OLD | NEW |
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 #include "content/browser/host_zoom_level_context.h" | 5 #include "content/browser/host_zoom_level_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "content/browser/host_zoom_map_impl.h" | 10 #include "content/browser/host_zoom_map_impl.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 HostZoomLevelContext::HostZoomLevelContext( | 15 HostZoomLevelContext::HostZoomLevelContext( |
16 scoped_ptr<ZoomLevelDelegate> zoom_level_delegate) | 16 std::unique_ptr<ZoomLevelDelegate> zoom_level_delegate) |
17 : host_zoom_map_impl_(new HostZoomMapImpl()), | 17 : host_zoom_map_impl_(new HostZoomMapImpl()), |
18 zoom_level_delegate_(std::move(zoom_level_delegate)) { | 18 zoom_level_delegate_(std::move(zoom_level_delegate)) { |
19 if (zoom_level_delegate_) | 19 if (zoom_level_delegate_) |
20 zoom_level_delegate_->InitHostZoomMap(host_zoom_map_impl_.get()); | 20 zoom_level_delegate_->InitHostZoomMap(host_zoom_map_impl_.get()); |
21 } | 21 } |
22 | 22 |
23 HostZoomLevelContext::~HostZoomLevelContext() {} | 23 HostZoomLevelContext::~HostZoomLevelContext() {} |
24 | 24 |
25 void HostZoomLevelContext::DeleteOnCorrectThread() const { | 25 void HostZoomLevelContext::DeleteOnCorrectThread() const { |
26 if (BrowserThread::IsMessageLoopValid(BrowserThread::UI) && | 26 if (BrowserThread::IsMessageLoopValid(BrowserThread::UI) && |
27 !BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 27 !BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
28 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 28 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
29 return; | 29 return; |
30 } | 30 } |
31 delete this; | 31 delete this; |
32 } | 32 } |
33 | 33 |
34 } // namespace content | 34 } // namespace content |
OLD | NEW |