 Chromium Code Reviews
 Chromium Code Reviews Issue 2705293014:
  Created web::UserAgentType.  (Closed)
    
  
    Issue 2705293014:
  Created web::UserAgentType.  (Closed) 
  | Index: ios/web/navigation/navigation_item_impl.mm | 
| diff --git a/ios/web/navigation/navigation_item_impl.mm b/ios/web/navigation/navigation_item_impl.mm | 
| index 31f357566080a0b3b5613312130691500edc34bc..bf3cec8042730de964fbcccac59194927c5001b6 100644 | 
| --- a/ios/web/navigation/navigation_item_impl.mm | 
| +++ b/ios/web/navigation/navigation_item_impl.mm | 
| @@ -12,6 +12,7 @@ | 
| #include "base/logging.h" | 
| #include "components/url_formatter/url_formatter.h" | 
| #import "ios/web/navigation/navigation_manager_impl.h" | 
| +#import "ios/web/public/web_client.h" | 
| #include "ui/base/page_transition_types.h" | 
| #include "ui/gfx/text_elider.h" | 
| @@ -40,7 +41,7 @@ static int GetUniqueIDInConstructor() { | 
| NavigationItemImpl::NavigationItemImpl() | 
| : unique_id_(GetUniqueIDInConstructor()), | 
| transition_type_(ui::PAGE_TRANSITION_LINK), | 
| - is_overriding_user_agent_(false), | 
| + user_agent_type_(UserAgentType::MOBILE), | 
| is_created_from_push_state_(false), | 
| has_state_been_replaced_(false), | 
| is_created_from_hash_change_(false), | 
| @@ -64,7 +65,7 @@ static int GetUniqueIDInConstructor() { | 
| favicon_(item.favicon_), | 
| ssl_(item.ssl_), | 
| timestamp_(item.timestamp_), | 
| - is_overriding_user_agent_(item.is_overriding_user_agent_), | 
| + user_agent_type_(item.user_agent_type_), | 
| http_request_headers_([item.http_request_headers_ copy]), | 
| serialized_state_object_([item.serialized_state_object_ copy]), | 
| is_created_from_push_state_(item.is_created_from_push_state_), | 
| @@ -206,13 +207,16 @@ static int GetUniqueIDInConstructor() { | 
| return timestamp_; | 
| } | 
| -void NavigationItemImpl::SetIsOverridingUserAgent( | 
| - bool is_overriding_user_agent) { | 
| - is_overriding_user_agent_ = is_overriding_user_agent; | 
| +void NavigationItemImpl::SetUserAgentType(UserAgentType type) { | 
| + user_agent_type_ = type; | 
| + url_ = original_request_url_; | 
| 
Eugene But (OOO till 7-30)
2017/02/27 23:55:18
Why? The old code and NavigationEntryImpl is not d
 
liaoyuke
2017/03/01 01:33:56
Actually, now I think this is bad. We may justify
 
kkhorimoto
2017/03/01 18:29:25
I've reverted this change, instead only setting |u
 | 
| + virtual_url_ = GURL(); | 
| + DCHECK_EQ(GetWebClient()->IsAppSpecificURL(GetVirtualURL()), | 
| + user_agent_type_ == UserAgentType::NONE); | 
| } | 
| -bool NavigationItemImpl::IsOverridingUserAgent() const { | 
| - return is_overriding_user_agent_; | 
| +UserAgentType NavigationItemImpl::GetUserAgentType() const { | 
| + return user_agent_type_; | 
| } | 
| bool NavigationItemImpl::HasPostData() const { |