summaryrefslogtreecommitdiffstats
path: root/content/browser/host_zoom_level_context.cc
blob: 02ddcf55d3c499765bf2c59fb0b7618f60896a3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/host_zoom_level_context.h"

#include "base/files/file_path.h"
#include "content/browser/host_zoom_map_impl.h"
#include "content/public/browser/browser_thread.h"

namespace content {

HostZoomLevelContext::HostZoomLevelContext(
    scoped_ptr<ZoomLevelDelegate> zoom_level_delegate)
    : host_zoom_map_impl_(new HostZoomMapImpl()),
      zoom_level_delegate_(zoom_level_delegate.Pass()) {
  if (zoom_level_delegate_)
    zoom_level_delegate_->InitHostZoomMap(host_zoom_map_impl_.get());
}

HostZoomLevelContext::~HostZoomLevelContext() {}

void HostZoomLevelContext::DeleteOnCorrectThread() const {
  if (BrowserThread::IsMessageLoopValid(BrowserThread::UI) &&
      !BrowserThread::CurrentlyOn(BrowserThread::UI)) {
    BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
    return;
  }
  delete this;
}

}  // namespace content