OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 class WebState; | 22 class WebState; |
23 class TestWebState; | 23 class TestWebState; |
24 class WebStateImpl; | 24 class WebStateImpl; |
25 | 25 |
26 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; | 26 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; |
27 | 27 |
28 // An observer API implemented by classes which are interested in various page | 28 // An observer API implemented by classes which are interested in various page |
29 // load events from WebState. | 29 // load events from WebState. |
30 class WebStateObserver { | 30 class WebStateObserver { |
31 public: | 31 public: |
32 // Key code associated to form events for which the key code is missing or | |
33 // irrelevant. | |
34 static int kInvalidFormKeyCode; | |
35 | |
36 // Returns the web state associated with this observer. | 32 // Returns the web state associated with this observer. |
37 WebState* web_state() const { return web_state_; } | 33 WebState* web_state() const { return web_state_; } |
38 | 34 |
39 // This method is invoked when a load request is registered. | 35 // This method is invoked when a load request is registered. |
40 virtual void ProvisionalNavigationStarted(const GURL& url) {} | 36 virtual void ProvisionalNavigationStarted(const GURL& url) {} |
41 | 37 |
42 // This method is invoked when committed navigation items have been pruned. | 38 // This method is invoked when committed navigation items have been pruned. |
43 virtual void NavigationItemsPruned(size_t pruned_item_count) {} | 39 virtual void NavigationItemsPruned(size_t pruned_item_count) {} |
44 | 40 |
45 // This method is invoked when a navigation item has changed. | 41 // This method is invoked when a navigation item has changed. |
(...skipping 24 matching lines...) Expand all Loading... |
70 // Called on history state change events. | 66 // Called on history state change events. |
71 virtual void HistoryStateChanged() {} | 67 virtual void HistoryStateChanged() {} |
72 | 68 |
73 // Called on form submission. |user_initiated| is true if the user | 69 // Called on form submission. |user_initiated| is true if the user |
74 // interacted with the page. | 70 // interacted with the page. |
75 virtual void DocumentSubmitted(const std::string& form_name, | 71 virtual void DocumentSubmitted(const std::string& form_name, |
76 bool user_initiated) {} | 72 bool user_initiated) {} |
77 | 73 |
78 // Called when the user is typing on a form field, with |error| indicating if | 74 // Called when the user is typing on a form field, with |error| indicating if |
79 // there is any error when parsing the form field information. | 75 // there is any error when parsing the form field information. |
80 // |key_code| may be kInvalidFormKeyCode if there is no key code. | |
81 virtual void FormActivityRegistered(const std::string& form_name, | 76 virtual void FormActivityRegistered(const std::string& form_name, |
82 const std::string& field_name, | 77 const std::string& field_name, |
83 const std::string& type, | 78 const std::string& type, |
84 const std::string& value, | 79 const std::string& value, |
85 int key_code, | |
86 bool input_missing) {} | 80 bool input_missing) {} |
87 | 81 |
88 // Invoked when new favicon URL candidates are received. | 82 // Invoked when new favicon URL candidates are received. |
89 virtual void FaviconUrlUpdated(const std::vector<FaviconURL>& candidates) {} | 83 virtual void FaviconUrlUpdated(const std::vector<FaviconURL>& candidates) {} |
90 | 84 |
91 // Notifies the observer that the credential manager API was invoked from | 85 // Notifies the observer that the credential manager API was invoked from |
92 // |source_url| to request a credential from the browser. If |unmediated| | 86 // |source_url| to request a credential from the browser. If |unmediated| |
93 // is true, the browser MUST NOT show any UI to the user. If this means that | 87 // is true, the browser MUST NOT show any UI to the user. If this means that |
94 // no credential will be returned to the page, so be it. Otherwise, the | 88 // no credential will be returned to the page, so be it. Otherwise, the |
95 // browser may show the user any UI that is necessary to get a Credential and | 89 // browser may show the user any UI that is necessary to get a Credential and |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 void ResetWebState(); | 157 void ResetWebState(); |
164 | 158 |
165 WebState* web_state_; | 159 WebState* web_state_; |
166 | 160 |
167 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); | 161 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); |
168 }; | 162 }; |
169 | 163 |
170 } // namespace web | 164 } // namespace web |
171 | 165 |
172 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 166 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
OLD | NEW |