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

Side by Side Diff: ios/web/web_state/navigation_context_impl.h

Issue 2896623003: Added web::NavigationContext::GetPageTransition. (Closed)
Patch Set: Fixed condition for SetIsCreatedFromHashChange call Created 3 years, 7 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 #ifndef IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ 5 #ifndef IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_
6 #define IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ 6 #define IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "ios/web/public/web_state/navigation_context.h" 12 #include "ios/web/public/web_state/navigation_context.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace web { 15 namespace web {
16 16
17 // Tracks information related to a single navigation. 17 // Tracks information related to a single navigation.
18 class NavigationContextImpl : public NavigationContext { 18 class NavigationContextImpl : public NavigationContext {
19 public: 19 public:
20 // Creates navigation context for sucessful navigation to a different page. 20 // Creates navigation context for sucessful navigation to a different page.
21 // Response headers will ne null. 21 // Response headers will ne null.
22 static std::unique_ptr<NavigationContextImpl> CreateNavigationContext( 22 static std::unique_ptr<NavigationContextImpl> CreateNavigationContext(
23 WebState* web_state, 23 WebState* web_state,
24 const GURL& url); 24 const GURL& url,
25 ui::PageTransition page_transition);
25 26
26 #ifndef NDEBUG 27 #ifndef NDEBUG
27 // Returns human readable description of this object. 28 // Returns human readable description of this object.
28 NSString* GetDescription() const; 29 NSString* GetDescription() const;
29 #endif // NDEBUG 30 #endif // NDEBUG
30 31
31 // NavigationContext overrides: 32 // NavigationContext overrides:
32 WebState* GetWebState() override; 33 WebState* GetWebState() override;
33 const GURL& GetUrl() const override; 34 const GURL& GetUrl() const override;
35 ui::PageTransition GetPageTransition() const override;
34 bool IsSameDocument() const override; 36 bool IsSameDocument() const override;
35 bool IsErrorPage() const override; 37 bool IsErrorPage() const override;
36 net::HttpResponseHeaders* GetResponseHeaders() const override; 38 net::HttpResponseHeaders* GetResponseHeaders() const override;
37 ~NavigationContextImpl() override; 39 ~NavigationContextImpl() override;
38 40
39 // Setters for navigation context data members. 41 // Setters for navigation context data members.
40 void SetIsSameDocument(bool is_same_document); 42 void SetIsSameDocument(bool is_same_document);
41 void SetIsErrorPage(bool is_error_page); 43 void SetIsErrorPage(bool is_error_page);
42 void SetResponseHeaders( 44 void SetResponseHeaders(
43 const scoped_refptr<net::HttpResponseHeaders>& response_headers); 45 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
44 46
45 // Optional unique id of the navigation item associated with this navigaiton. 47 // Optional unique id of the navigation item associated with this navigaiton.
46 int GetNavigationItemUniqueID() const; 48 int GetNavigationItemUniqueID() const;
47 void SetNavigationItemUniqueID(int unique_id); 49 void SetNavigationItemUniqueID(int unique_id);
48 50
49 private: 51 private:
50 NavigationContextImpl( 52 NavigationContextImpl(
51 WebState* web_state, 53 WebState* web_state,
52 const GURL& url, 54 const GURL& url,
55 ui::PageTransition page_transition,
53 bool is_same_page, 56 bool is_same_page,
54 bool is_error_page, 57 bool is_error_page,
55 const scoped_refptr<net::HttpResponseHeaders>& response_headers); 58 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
56 59
57 WebState* web_state_ = nullptr; 60 WebState* web_state_ = nullptr;
58 GURL url_; 61 GURL url_;
62 ui::PageTransition page_transition_;
59 bool is_same_document_ = false; 63 bool is_same_document_ = false;
60 bool is_error_page_ = false; 64 bool is_error_page_ = false;
61 scoped_refptr<net::HttpResponseHeaders> response_headers_; 65 scoped_refptr<net::HttpResponseHeaders> response_headers_;
62 int navigation_item_unique_id_ = -1; 66 int navigation_item_unique_id_ = -1;
63 67
64 DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl); 68 DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl);
65 }; 69 };
66 70
67 } // namespace web 71 } // namespace web
68 72
69 #endif // IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ 73 #endif // IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698