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