Fix flakiness in DumpAccessibilityEvent* tests.
[chromium-blink-merge.git] / content / browser / host_zoom_level_context.cc
blob02ddcf55d3c499765bf2c59fb0b7618f60896a3a
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.
5 #include "content/browser/host_zoom_level_context.h"
7 #include "base/files/file_path.h"
8 #include "content/browser/host_zoom_map_impl.h"
9 #include "content/public/browser/browser_thread.h"
11 namespace content {
13 HostZoomLevelContext::HostZoomLevelContext(
14 scoped_ptr<ZoomLevelDelegate> zoom_level_delegate)
15 : host_zoom_map_impl_(new HostZoomMapImpl()),
16 zoom_level_delegate_(zoom_level_delegate.Pass()) {
17 if (zoom_level_delegate_)
18 zoom_level_delegate_->InitHostZoomMap(host_zoom_map_impl_.get());
21 HostZoomLevelContext::~HostZoomLevelContext() {}
23 void HostZoomLevelContext::DeleteOnCorrectThread() const {
24 if (BrowserThread::IsMessageLoopValid(BrowserThread::UI) &&
25 !BrowserThread::CurrentlyOn(BrowserThread::UI)) {
26 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
27 return;
29 delete this;
32 } // namespace content