cef/libcef/browser_zoom_map.cc
Marshall Greenblatt c9b8e88dd9 Add zoom support (issue #116).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@167 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2011-01-25 15:34:50 +00:00

39 lines
861 B
C++

// Copyright (c) 2011 The Chromium Embedded Framework 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 "browser_zoom_map.h"
#include "cef_thread.h"
ZoomMap* ZoomMap::GetInstance()
{
return Singleton<ZoomMap>::get();
}
void ZoomMap::set(const GURL& url, double zoomLevel)
{
REQUIRE_UIT();
if (zoomLevel == 0.) {
// Remove the entry for this host.
Map::iterator iter = map_.find(url.host());
if (iter != map_.end())
map_.erase(iter);
} else {
// Update the entry for this host.
map_[url.host()] = zoomLevel;
}
}
bool ZoomMap::get(const GURL& url, double& zoomLevel)
{
REQUIRE_UIT();
Map::const_iterator iter = map_.find(url.host());
if (iter == map_.end())
return false;
zoomLevel = iter->second;
return true;
}