This source file includes following definitions.
- create
- setValueAndClosePopup
- setValue
- closePopup
- localizeNumberString
- formatMonth
- formatShortMonth
- clearPagePopupClient
- histogramEnumeration
#include "config.h"
#include "core/page/PagePopupController.h"
#include "core/page/PagePopupClient.h"
#include "platform/text/PlatformLocale.h"
#include "public/platform/Platform.h"
namespace WebCore {
PagePopupController::PagePopupController(PagePopupClient* client)
: m_popupClient(client)
{
ASSERT(client);
ScriptWrappable::init(this);
}
PassRefPtrWillBeRawPtr<PagePopupController> PagePopupController::create(PagePopupClient* client)
{
return adoptRefWillBeNoop(new PagePopupController(client));
}
void PagePopupController::setValueAndClosePopup(int numValue, const String& stringValue)
{
if (m_popupClient)
m_popupClient->setValueAndClosePopup(numValue, stringValue);
}
void PagePopupController::setValue(const String& value)
{
if (m_popupClient)
m_popupClient->setValue(value);
}
void PagePopupController::closePopup()
{
if (m_popupClient)
m_popupClient->closePopup();
}
String PagePopupController::localizeNumberString(const String& numberString)
{
if (m_popupClient)
return m_popupClient->locale().convertToLocalizedNumber(numberString);
return numberString;
}
String PagePopupController::formatMonth(int year, int zeroBaseMonth)
{
if (!m_popupClient)
return emptyString();
DateComponents date;
date.setMonthsSinceEpoch((year - 1970) * 12.0 + zeroBaseMonth);
return m_popupClient->locale().formatDateTime(date, Locale::FormatTypeMedium);
}
String PagePopupController::formatShortMonth(int year, int zeroBaseMonth)
{
if (!m_popupClient)
return emptyString();
DateComponents date;
date.setMonthsSinceEpoch((year - 1970) * 12.0 + zeroBaseMonth);
return m_popupClient->locale().formatDateTime(date, Locale::FormatTypeShort);
}
void PagePopupController::clearPagePopupClient()
{
m_popupClient = 0;
}
void PagePopupController::histogramEnumeration(const String& name, int sample, int boundaryValue)
{
blink::Platform::current()->histogramEnumeration(name.utf8().data(), sample, boundaryValue);
}
}