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

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

Issue 2838583002: Added Setters to NavigationContextImpl. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | ios/web/web_state/navigation_context_impl.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
22 static std::unique_ptr<NavigationContextImpl> CreateNavigationContext(
23 WebState* web_state,
24 const GURL& url);
25
26 // Creates navigation context for sucessful navigation to a different page.
kkhorimoto 2017/04/25 13:53:26 Do you want to mention that this factory method is
Eugene But (OOO till 7-30) 2017/04/27 12:18:59 I'll just remove them in this CL: https://coderevi
21 static std::unique_ptr<NavigationContextImpl> CreateNavigationContext( 27 static std::unique_ptr<NavigationContextImpl> CreateNavigationContext(
22 WebState* web_state, 28 WebState* web_state,
23 const GURL& url, 29 const GURL& url,
24 const scoped_refptr<net::HttpResponseHeaders>& response_headers); 30 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
25 31
26 // Creates navigation context for sucessful same page navigation. 32 // Creates navigation context for sucessful same page navigation.
27 static std::unique_ptr<NavigationContextImpl> 33 static std::unique_ptr<NavigationContextImpl>
28 CreateSameDocumentNavigationContext(WebState* web_state, const GURL& url); 34 CreateSameDocumentNavigationContext(WebState* web_state, const GURL& url);
29 35
30 // Creates navigation context for the error page navigation. 36 // Creates navigation context for the error page navigation.
31 static std::unique_ptr<NavigationContextImpl> 37 static std::unique_ptr<NavigationContextImpl>
32 CreateErrorPageNavigationContext( 38 CreateErrorPageNavigationContext(
33 WebState* web_state, 39 WebState* web_state,
34 const GURL& url, 40 const GURL& url,
35 const scoped_refptr<net::HttpResponseHeaders>& response_headers); 41 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
36 42
37 #ifndef NDEBUG 43 #ifndef NDEBUG
38 // Returns human readable description of this object. 44 // Returns human readable description of this object.
39 NSString* GetDescription() const; 45 NSString* GetDescription() const;
40 #endif // NDEBUG 46 #endif // NDEBUG
41 47
42 // NavigationContext overrides: 48 // NavigationContext overrides:
43 WebState* GetWebState() override; 49 WebState* GetWebState() override;
44 const GURL& GetUrl() const override; 50 const GURL& GetUrl() const override;
45 bool IsSameDocument() const override; 51 bool IsSameDocument() const override;
46 bool IsErrorPage() const override; 52 bool IsErrorPage() const override;
47 net::HttpResponseHeaders* GetResponseHeaders() const override; 53 net::HttpResponseHeaders* GetResponseHeaders() const override;
48 ~NavigationContextImpl() override; 54 ~NavigationContextImpl() override;
49 55
56 // Setters for navigation context data members.
57 void SetIsSameDocument(bool is_same_document);
kkhorimoto 2017/04/25 13:53:25 Do we need to expose a setter for IsSameDocument?
Eugene But (OOO till 7-30) 2017/04/27 12:18:59 This is needed for user-initiated fragment change
58 void SetIsErrorPage(bool is_error_page);
59 void SetResponseHeaders(
60 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
61
50 private: 62 private:
51 NavigationContextImpl( 63 NavigationContextImpl(
52 WebState* web_state, 64 WebState* web_state,
53 const GURL& url, 65 const GURL& url,
54 bool is_same_page, 66 bool is_same_page,
55 bool is_error_page, 67 bool is_error_page,
56 const scoped_refptr<net::HttpResponseHeaders>& response_headers); 68 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
57 69
58 WebState* web_state_ = nullptr; 70 WebState* web_state_ = nullptr;
59 GURL url_; 71 GURL url_;
60 bool is_same_document_ = false; 72 bool is_same_document_ = false;
61 bool is_error_page_ = false; 73 bool is_error_page_ = false;
62 scoped_refptr<net::HttpResponseHeaders> response_headers_; 74 scoped_refptr<net::HttpResponseHeaders> response_headers_;
63 75
64 DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl); 76 DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl);
65 }; 77 };
66 78
67 } // namespace web 79 } // namespace web
68 80
69 #endif // IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ 81 #endif // IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | ios/web/web_state/navigation_context_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698