Commit 11368d1e authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Fix UserAgent

A todo that was left from previous CL.

Bug: 1025225
Change-Id: I0f0bfbfbeeef992db102a6b2326eac353a0bf4a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144075
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760065}
parent 95e38b56
...@@ -61,7 +61,7 @@ class ChromeWebClient : public web::WebClient { ...@@ -61,7 +61,7 @@ class ChromeWebClient : public web::WebClient {
base::OnceCallback<void(NSString*)> callback) override; base::OnceCallback<void(NSString*)> callback) override;
UIView* GetWindowedContainer() override; UIView* GetWindowedContainer() override;
bool ForceMobileVersionByDefault(const GURL& url) override; bool ForceMobileVersionByDefault(const GURL& url) override;
web::UserAgentType GetDefaultUserAgent(UIView* web_view, web::UserAgentType GetDefaultUserAgent(id<UITraitEnvironment> web_view,
const GURL& url) override; const GURL& url) override;
private: private:
......
...@@ -273,7 +273,8 @@ bool ChromeWebClient::ForceMobileVersionByDefault(const GURL& url) { ...@@ -273,7 +273,8 @@ bool ChromeWebClient::ForceMobileVersionByDefault(const GURL& url) {
return false; return false;
} }
web::UserAgentType ChromeWebClient::GetDefaultUserAgent(UIView* web_view, web::UserAgentType ChromeWebClient::GetDefaultUserAgent(
id<UITraitEnvironment> web_view,
const GURL& url) { const GURL& url) {
DCHECK(base::FeatureList::IsEnabled( DCHECK(base::FeatureList::IsEnabled(
web::features::kUseDefaultUserAgentInWebClient)); web::features::kUseDefaultUserAgentInWebClient));
......
...@@ -228,8 +228,6 @@ UserAgentType NavigationItemImpl::GetUserAgentType( ...@@ -228,8 +228,6 @@ UserAgentType NavigationItemImpl::GetUserAgentType(
if (user_agent_type_ == UserAgentType::AUTOMATIC) { if (user_agent_type_ == UserAgentType::AUTOMATIC) {
DCHECK(base::FeatureList::IsEnabled( DCHECK(base::FeatureList::IsEnabled(
features::kUseDefaultUserAgentInWebClient)); features::kUseDefaultUserAgentInWebClient));
// TODO: Find a way to get the WebView. Passed as parameter?
UIView* web_view = nil;
return GetWebClient()->GetDefaultUserAgent(web_view, url_); return GetWebClient()->GetDefaultUserAgent(web_view, url_);
} }
return user_agent_type_; return user_agent_type_;
......
...@@ -61,7 +61,8 @@ class TestWebClient : public web::WebClient { ...@@ -61,7 +61,8 @@ class TestWebClient : public web::WebClient {
int64_t navigation_id, int64_t navigation_id,
base::OnceCallback<void(NSString*)> callback) override; base::OnceCallback<void(NSString*)> callback) override;
UIView* GetWindowedContainer() override; UIView* GetWindowedContainer() override;
UserAgentType GetDefaultUserAgent(UIView* web_view, const GURL& url) override; UserAgentType GetDefaultUserAgent(id<UITraitEnvironment> web_view,
const GURL& url) override;
// Sets |plugin_not_supported_text_|. // Sets |plugin_not_supported_text_|.
void SetPluginNotSupportedText(const base::string16& text); void SetPluginNotSupportedText(const base::string16& text);
......
...@@ -116,7 +116,8 @@ UIView* TestWebClient::GetWindowedContainer() { ...@@ -116,7 +116,8 @@ UIView* TestWebClient::GetWindowedContainer() {
return UIApplication.sharedApplication.keyWindow.rootViewController.view; return UIApplication.sharedApplication.keyWindow.rootViewController.view;
} }
UserAgentType TestWebClient::GetDefaultUserAgent(UIView* web_view, UserAgentType TestWebClient::GetDefaultUserAgent(
id<UITraitEnvironment> web_view,
const GURL& url) { const GURL& url) {
return default_user_agent_; return default_user_agent_;
} }
......
...@@ -197,7 +197,8 @@ class WebClient { ...@@ -197,7 +197,8 @@ class WebClient {
// Returns the UserAgentType that should be used by default for the web // Returns the UserAgentType that should be used by default for the web
// content, based on the size class of |web_view| and the |url|. // content, based on the size class of |web_view| and the |url|.
virtual UserAgentType GetDefaultUserAgent(UIView* web_view, const GURL& url); virtual UserAgentType GetDefaultUserAgent(id<UITraitEnvironment> web_view,
const GURL& url);
}; };
} // namespace web } // namespace web
......
...@@ -120,7 +120,7 @@ bool WebClient::ForceMobileVersionByDefault(const GURL&) { ...@@ -120,7 +120,7 @@ bool WebClient::ForceMobileVersionByDefault(const GURL&) {
return false; return false;
} }
UserAgentType WebClient::GetDefaultUserAgent(UIView* web_view, UserAgentType WebClient::GetDefaultUserAgent(id<UITraitEnvironment> web_view,
const GURL& url) { const GURL& url) {
return UserAgentType::MOBILE; return UserAgentType::MOBILE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment