Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: ios/web/navigation/navigation_item_impl.mm

Issue 2698773002: [iOS] Refactoring web CRWSessionController user agent code. (Closed)
Patch Set: Update NavigationItemImpl to use NavigationInitiationType Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 3b626905bf54a05d7ae07076c217ee09eccac42a..43cf5fa515c1d207c7516b260d44f0fa1180a218 100644
--- a/ios/web/navigation/navigation_item_impl.mm
+++ b/ios/web/navigation/navigation_item_impl.mm
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "components/url_formatter/url_formatter.h"
+#import "ios/web/navigation/navigation_manager_impl.h"
#include "ui/base/page_transition_types.h"
#include "ui/gfx/text_elider.h"
@@ -44,7 +45,8 @@ static int GetUniqueIDInConstructor() {
has_state_been_replaced_(false),
is_created_from_hash_change_(false),
should_skip_repost_form_confirmation_(false),
- is_renderer_initiated_(false),
+ navigation_initiation_type_(
+ web::NavigationInitiationType::USER_INITIATED),
kkhorimoto 2017/02/17 20:51:35 This should be initialized to RENDERER_INITIATED f
liaoyuke 2017/02/17 22:15:40 Per offline discussion, will do this in a separate
is_unsafe_(false),
facade_delegate_(nullptr) {}
@@ -72,7 +74,7 @@ static int GetUniqueIDInConstructor() {
should_skip_repost_form_confirmation_(
item.should_skip_repost_form_confirmation_),
post_data_([item.post_data_ copy]),
- is_renderer_initiated_(item.is_renderer_initiated_),
+ navigation_initiation_type_(item.navigation_initiation_type_),
is_unsafe_(item.is_unsafe_),
cached_display_title_(item.cached_display_title_),
facade_delegate_(nullptr) {}
@@ -250,6 +252,17 @@ static int GetUniqueIDInConstructor() {
return is_created_from_push_state_;
}
+void NavigationItemImpl::SetIsRendererInitiated(bool is_renderer_initiated) {
+ navigation_initiation_type_ =
+ is_renderer_initiated ? web::NavigationInitiationType::RENDERER_INITIATED
+ : web::NavigationInitiationType::USER_INITIATED;
+}
+
+bool NavigationItemImpl::IsRendererInitiated() const {
+ return navigation_initiation_type_ ==
+ web::NavigationInitiationType::RENDERER_INITIATED;
+}
+
void NavigationItemImpl::SetHasStateBeenReplaced(bool replace_state) {
has_state_been_replaced_ = replace_state;
}
@@ -296,7 +309,7 @@ static int GetUniqueIDInConstructor() {
void NavigationItemImpl::ResetForCommit() {
// Any state that only matters when a navigation item is pending should be
// cleared here.
- set_is_renderer_initiated(false);
+ SetIsRendererInitiated(false);
}
} // namespace web

Powered by Google App Engine
This is Rietveld 408576698