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

Side by Side Diff: ios/web/navigation/legacy_navigation_manager_impl.mm

Issue 2957163002: [Navigation Experiment] Add WKBasedNavigationManagerImpl. (Closed)
Patch Set: Patch for review Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/navigation/legacy_navigation_manager_impl.h" 5 #import "ios/web/navigation/legacy_navigation_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #import "ios/web/navigation/crw_session_controller+private_constructors.h" 12 #import "ios/web/navigation/crw_session_controller+private_constructors.h"
13 #import "ios/web/navigation/crw_session_controller.h" 13 #import "ios/web/navigation/crw_session_controller.h"
14 #import "ios/web/navigation/navigation_item_impl.h" 14 #import "ios/web/navigation/navigation_item_impl.h"
15 #import "ios/web/navigation/navigation_item_impl_list.h" 15 #import "ios/web/navigation/navigation_item_impl_list.h"
16 #import "ios/web/navigation/navigation_manager_delegate.h" 16 #import "ios/web/navigation/navigation_manager_delegate.h"
17 #include "ios/web/public/load_committed_details.h" 17 #include "ios/web/public/load_committed_details.h"
18 #import "ios/web/public/navigation_item.h" 18 #import "ios/web/public/navigation_item.h"
19 #include "ios/web/public/reload_type.h" 19 #include "ios/web/public/reload_type.h"
20 #import "ios/web/public/web_client.h" 20 #import "ios/web/public/web_client.h"
21 #import "ios/web/public/web_state/web_state.h" 21 #import "ios/web/public/web_state/web_state.h"
22 #include "ui/base/page_transition_types.h" 22 #include "ui/base/page_transition_types.h"
23 23
24 #if !defined(__has_feature) || !__has_feature(objc_arc) 24 #if !defined(__has_feature) || !__has_feature(objc_arc)
25 #error "This file requires ARC support." 25 #error "This file requires ARC support."
26 #endif 26 #endif
27 27
28 namespace {
29
30 // Checks whether or not two URL are an in-page navigation (differing only
31 // in the fragment).
32 bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
33 if (existing_url == new_url || !new_url.has_ref())
34 return false;
35
36 return existing_url.EqualsIgnoringRef(new_url);
37 }
38
39 } // anonymous namespace
40
41 namespace web { 28 namespace web {
42 29
43 NavigationManager::WebLoadParams::WebLoadParams(const GURL& url)
44 : url(url),
45 transition_type(ui::PAGE_TRANSITION_LINK),
46 user_agent_override_option(UserAgentOverrideOption::INHERIT),
47 is_renderer_initiated(false),
48 post_data(nil) {}
49
50 NavigationManager::WebLoadParams::~WebLoadParams() {}
51
52 NavigationManager::WebLoadParams::WebLoadParams(const WebLoadParams& other)
53 : url(other.url),
54 referrer(other.referrer),
55 transition_type(other.transition_type),
56 user_agent_override_option(other.user_agent_override_option),
57 is_renderer_initiated(other.is_renderer_initiated),
58 extra_headers([other.extra_headers copy]),
59 post_data([other.post_data copy]) {}
60
61 NavigationManager::WebLoadParams& NavigationManager::WebLoadParams::operator=(
62 const WebLoadParams& other) {
63 url = other.url;
64 referrer = other.referrer;
65 is_renderer_initiated = other.is_renderer_initiated;
66 transition_type = other.transition_type;
67 user_agent_override_option = other.user_agent_override_option;
68 extra_headers.reset([other.extra_headers copy]);
69 post_data.reset([other.post_data copy]);
70
71 return *this;
72 }
73
74 LegacyNavigationManagerImpl::LegacyNavigationManagerImpl() 30 LegacyNavigationManagerImpl::LegacyNavigationManagerImpl()
75 : delegate_(nullptr), browser_state_(nullptr) {} 31 : delegate_(nullptr), browser_state_(nullptr) {}
76 32
77 LegacyNavigationManagerImpl::~LegacyNavigationManagerImpl() { 33 LegacyNavigationManagerImpl::~LegacyNavigationManagerImpl() {
78 [session_controller_ setNavigationManager:nullptr]; 34 [session_controller_ setNavigationManager:nullptr];
79 } 35 }
80 36
81 void LegacyNavigationManagerImpl::SetDelegate( 37 void LegacyNavigationManagerImpl::SetDelegate(
82 NavigationManagerDelegate* delegate) { 38 NavigationManagerDelegate* delegate) {
83 delegate_ = delegate; 39 delegate_ = delegate;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 return item; 410 return item;
455 } 411 }
456 return nullptr; 412 return nullptr;
457 } 413 }
458 414
459 int LegacyNavigationManagerImpl::GetPreviousItemIndex() const { 415 int LegacyNavigationManagerImpl::GetPreviousItemIndex() const {
460 return base::checked_cast<int>([session_controller_ previousItemIndex]); 416 return base::checked_cast<int>([session_controller_ previousItemIndex]);
461 } 417 }
462 418
463 } // namespace web 419 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698