2011-01-25 16:34:50 +01:00
|
|
|
// 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.
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_ZOOM_MAP_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_ZOOM_MAP_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2011-01-25 16:34:50 +01:00
|
|
|
|
2011-05-20 22:52:47 +02:00
|
|
|
#include "include/internal/cef_string.h"
|
2011-04-05 18:17:33 +02:00
|
|
|
#include "base/memory/singleton.h"
|
2011-01-25 16:34:50 +01:00
|
|
|
#include "googleurl/src/gurl.h"
|
|
|
|
|
|
|
|
// Maps the host/domain of a URL to a zoom value.
|
|
|
|
// NOTE: This class is not thread-safe. It is assumed that the methods will be
|
|
|
|
// called from the UI thread.
|
2012-01-10 00:46:23 +01:00
|
|
|
class ZoomMap {
|
|
|
|
public:
|
2011-01-25 16:34:50 +01:00
|
|
|
// Returns the static ZoomMap instance.
|
|
|
|
static ZoomMap* GetInstance();
|
|
|
|
|
|
|
|
// Store |zoomLevel| with key |url|.
|
|
|
|
void set(const GURL& url, double zoomLevel);
|
|
|
|
|
|
|
|
// Returns true if there is a |zoomLevel| keyed with |url|, false otherwise.
|
|
|
|
// |zoomLevel| is the "out" variable.
|
|
|
|
bool get(const GURL& url, double& zoomLevel);
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
private:
|
2011-01-25 16:34:50 +01:00
|
|
|
typedef std::map<std::string, double> Map;
|
|
|
|
Map map_;
|
|
|
|
|
|
|
|
friend struct DefaultSingletonTraits<ZoomMap>;
|
|
|
|
|
|
|
|
ZoomMap() {}
|
|
|
|
virtual ~ZoomMap() {}
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ZoomMap);
|
|
|
|
};
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_ZOOM_MAP_H_
|