value << "]");
m_BackgroundSupport = BackgroundSupport_Disable;
}
- }
- else {
+ } else if (name == SETTING_NAME_USER_AGENT) {
+ DPL::OptionalString userAgent = value;
+ if (!userAgent.IsNull()) {
+ m_UserAgent = DPL::ToUTF8String(*userAgent);
+ }
+ } else {
LogError("Invalid setting name!! [" << name << "]");
}
}
return false;
}
+std::string WidgetSettingList::getUserAgent() const
+{
+ return m_UserAgent;
+}
+
bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
{
return m_RotationLock == other.m_RotationLock &&
m_BackButtonPresence == other.m_BackButtonPresence &&
m_ContextMenu == other.m_ContextMenu &&
m_Encryption == other.m_Encryption &&
- m_BackgroundSupport == other.m_BackgroundSupport;
+ m_BackgroundSupport == other.m_BackgroundSupport &&
+ m_UserAgent == other.m_UserAgent;
}
L"context-menu";
static const DPL::String SETTING_NAME_BACKGROUND_SUPPORT =
L"background-support";
+static const DPL::String SETTING_NAME_USER_AGENT =
+ L"user-agent";
static const DPL::String SETTING_VALUE_ENABLE =
L"enable";
static const DPL::String SETTING_VALUE_DISABLE =
bool isEncrypted() const;
+ std::string getUserAgent() const;
+
bool operator ==(const WidgetSettingList& other) const;
private:
WidgetSettingContextMenu m_ContextMenu;
WidgetSettingEncryption m_Encryption;
WidgetSettingBackgroundSupport m_BackgroundSupport;
+ std::string m_UserAgent;
};
#endif /* WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_ */
Ewk_Settings* settings = ewk_view_settings_get(wkView);
// set user agent
- auto userAgentString =
- ViewModule::UserAgentSupport::getUserAgentFromVconf();
- if (!userAgentString.empty()) {
- LogDebug("Setting custom user agent as: " << userAgentString);
- ewk_view_user_agent_set(wkView, userAgentString.c_str());
+ std::string customUserAgent = m_model->SettingList.Get().getUserAgent();
+ if (customUserAgent.empty()) {
+ auto userAgentString =
+ ViewModule::UserAgentSupport::getUserAgentFromVconf();
+ if (!userAgentString.empty()) {
+ LogDebug("Setting user agent as: " << userAgentString);
+ ewk_view_user_agent_set(wkView, userAgentString.c_str());
+ }
+ } else {
+ LogDebug("Setting custom user agent as: " << customUserAgent);
+ ewk_view_user_agent_set(wkView, customUserAgent.c_str());
}
// set custom header : language