#include "content/public/browser/web_contents_efl_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/common/result_codes.h"
+#include "net/http/http_util.h"
// Majority of the code in this file was taken directly from
// WebContentsImpl::CreateNewWindow. Compared to the original, the function
void WebContentsImplEfl::SetUserAgentOverride(
const blink::UserAgentOverride& ua_override,
- bool override_in_new_tabs) {}
+ bool override_in_new_tabs) {
+ if (GetUserAgentOverride() == ua_override)
+ return;
+
+ if (!ua_override.ua_string_override.empty() &&
+ !net::HttpUtil::IsValidHeaderValue(ua_override.ua_string_override)) {
+ return;
+ }
+
+ should_override_user_agent_in_new_tabs_ = override_in_new_tabs;
+
+ renderer_preferences_.user_agent_override = ua_override;
+
+ // Send the new override string to all renderers in the current page.
+ SyncRendererPrefs();
+
+ // In chromium upstream, the page is reloaded if a load is currently in
+ // progress. However, the behaviour is different for chromium efl port.
+
+ observers_.NotifyObservers(&WebContentsObserver::UserAgentOverrideSet,
+ ua_override);
+}
WebContentsImpl* WebContentsImplEfl::CreateWebContentsForNewWindow(
BrowserContext* browser_context,