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

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

Issue 2901633002: Replaced NavigationContext::IsErrorPage with NavigationContext::GetError (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
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 #import "base/mac/scoped_nsobject.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "ios/web/public/web_state/navigation_context.h" 13 #import "ios/web/public/web_state/navigation_context.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace web { 16 namespace web {
16 17
17 // Tracks information related to a single navigation. 18 // Tracks information related to a single navigation.
18 class NavigationContextImpl : public NavigationContext { 19 class NavigationContextImpl : public NavigationContext {
19 public: 20 public:
20 // Creates navigation context for sucessful navigation to a different page. 21 // Creates navigation context for sucessful navigation to a different page.
21 // Response headers will ne null. 22 // Response headers will ne null.
22 static std::unique_ptr<NavigationContextImpl> CreateNavigationContext( 23 static std::unique_ptr<NavigationContextImpl> CreateNavigationContext(
23 WebState* web_state, 24 WebState* web_state,
24 const GURL& url); 25 const GURL& url);
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;
34 bool IsSameDocument() const override; 35 bool IsSameDocument() const override;
35 bool IsErrorPage() const override; 36 NSError* GetError() const override;
36 net::HttpResponseHeaders* GetResponseHeaders() const override; 37 net::HttpResponseHeaders* GetResponseHeaders() const override;
37 ~NavigationContextImpl() override; 38 ~NavigationContextImpl() override;
38 39
39 // Setters for navigation context data members. 40 // Setters for navigation context data members.
40 void SetIsSameDocument(bool is_same_document); 41 void SetIsSameDocument(bool is_same_document);
41 void SetIsErrorPage(bool is_error_page); 42 void SetError(NSError* error);
42 void SetResponseHeaders( 43 void SetResponseHeaders(
43 const scoped_refptr<net::HttpResponseHeaders>& response_headers); 44 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
44 45
45 // Optional unique id of the navigation item associated with this navigaiton. 46 // Optional unique id of the navigation item associated with this navigaiton.
46 int GetNavigationItemUniqueID() const; 47 int GetNavigationItemUniqueID() const;
47 void SetNavigationItemUniqueID(int unique_id); 48 void SetNavigationItemUniqueID(int unique_id);
48 49
49 private: 50 private:
50 NavigationContextImpl( 51 NavigationContextImpl(WebState* web_state, const GURL& url);
51 WebState* web_state,
52 const GURL& url,
53 bool is_same_page,
54 bool is_error_page,
55 const scoped_refptr<net::HttpResponseHeaders>& response_headers);
56 52
57 WebState* web_state_ = nullptr; 53 WebState* web_state_ = nullptr;
58 GURL url_; 54 GURL url_;
59 bool is_same_document_ = false; 55 bool is_same_document_ = false;
60 bool is_error_page_ = false; 56 base::scoped_nsobject<NSError> error_;
61 scoped_refptr<net::HttpResponseHeaders> response_headers_; 57 scoped_refptr<net::HttpResponseHeaders> response_headers_;
62 int navigation_item_unique_id_ = -1; 58 int navigation_item_unique_id_ = -1;
63 59
64 DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl); 60 DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl);
65 }; 61 };
66 62
67 } // namespace web 63 } // namespace web
68 64
69 #endif // IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ 65 #endif // IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « ios/web/web_state/navigation_callbacks_inttest.mm ('k') | ios/web/web_state/navigation_context_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698