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

Side by Side Diff: ios/web/public/web_state/web_state_observer.h

Issue 1107083002: Upstream more leaf files in ios/web/web_state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-resync
Patch Set: Created 5 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 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 12
13 class GURL; 13 class GURL;
14 14
15 namespace web { 15 namespace web {
16 16
17 struct Credential;
17 struct FaviconURL; 18 struct FaviconURL;
18 struct LoadCommittedDetails; 19 struct LoadCommittedDetails;
19 class WebState; 20 class WebState;
20 class WebStateImpl; 21 class WebStateImpl;
21 22
22 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; 23 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 };
23 24
24 // An observer API implemented by classes which are interested in various page 25 // An observer API implemented by classes which are interested in various page
25 // load events from WebState. 26 // load events from WebState.
26 class WebStateObserver { 27 class WebStateObserver {
27 public: 28 public:
28 // Key code associated to form events for which the key code is missing or 29 // Key code associated to form events for which the key code is missing or
29 // irrelevant. 30 // irrelevant.
30 static int kInvalidFormKeyCode; 31 static int kInvalidFormKeyCode;
31 32
32 // Returns the web state associated with this observer. 33 // Returns the web state associated with this observer.
33 WebState* web_state() const { return web_state_; } 34 WebState* web_state() const { return web_state_; }
34 35
35 // This method is invoked when a load request is registered. 36 // This method is invoked when a load request is registered.
36 virtual void ProvisionalNavigationStarted(const GURL& url) {} 37 virtual void ProvisionalNavigationStarted(const GURL& url) {}
37 38
38 // This method is invoked when a new non-pending navigation item is created. 39 // This method is invoked when a new non-pending navigation item is created.
39 // This corresponds to one NavigationManager item being created 40 // This corresponds to one NavigationManager item being created
40 // (in the case of new navigations) or renavigated to (for back/forward 41 // (in the case of new navigations) or renavigated to (for back/forward
41 // navigations). 42 // navigations).
42 virtual void NavigationItemCommitted( 43 virtual void NavigationItemCommitted(
43 const LoadCommittedDetails& load_details) {} 44 const LoadCommittedDetails& load_details) {}
44 45
46 // Called when the current page has started loading.
47 virtual void DidStartLoading() {}
48
49 // Called when the current page has stopped loading.
50 virtual void DidStopLoading() {}
51
45 // Called when the current page is loaded. 52 // Called when the current page is loaded.
46 virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {} 53 virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {}
47 54
48 // Called when the interstitial is dismissed by the user. 55 // Called when the interstitial is dismissed by the user.
49 virtual void InsterstitialDismissed() {} 56 virtual void InsterstitialDismissed() {}
50 57
51 // Called on URL hash change events. 58 // Called on URL hash change events.
52 virtual void UrlHashChanged() {} 59 virtual void UrlHashChanged() {}
53 60
54 // Called on history state change events. 61 // Called on history state change events.
(...skipping 18 matching lines...) Expand all
73 // |source_url| for the form with the specified |form_name|. 80 // |source_url| for the form with the specified |form_name|.
74 // |user_initiated| indicates whether the API was invoked in response to a 81 // |user_initiated| indicates whether the API was invoked in response to a
75 // user interaction. 82 // user interaction.
76 virtual void AutocompleteRequested(const GURL& source_url, 83 virtual void AutocompleteRequested(const GURL& source_url,
77 const std::string& form_name, 84 const std::string& form_name,
78 bool user_initiated) {} 85 bool user_initiated) {}
79 86
80 // Invoked when new favicon URL candidates are received. 87 // Invoked when new favicon URL candidates are received.
81 virtual void FaviconUrlUpdated(const std::vector<FaviconURL>& candidates) {} 88 virtual void FaviconUrlUpdated(const std::vector<FaviconURL>& candidates) {}
82 89
90 // Notifies the observer that the credential manager API was invoked from
91 // |source_url| to request a credential from the browser. If |suppress_ui|
92 // is true, the browser MUST NOT show any UI to the user. If this means that
93 // no credential will be returned to the page, so be it. Otherwise, the
94 // browser may show the user any UI that is necessary to get a Credential and
95 // return it to the page. |federations| specifies a list of acceptable
96 // federation providers. |user_interaction| indicates whether the API was
97 // invoked in response to a user interaction. Responses to the page should
98 // provide the specified |request_id|.
99 virtual void CredentialsRequested(int request_id,
100 const GURL& source_url,
101 bool suppress_ui,
102 const std::vector<std::string>& federations,
103 bool is_user_initiated) {}
104
105 // Notifies the observer that the credential manager API was invoked from
106 // |source_url| to notify the browser that the user signed in. |credential|
107 // specifies the credential that was used to sign in. Responses to the page
108 // should provide the specified |request_id|.
109 virtual void SignedIn(int request_id,
110 const GURL& source_url,
111 const web::Credential& credential) {}
112
113 // Notifies the observer that the credential manager API was invoked from
114 // |source_url| to notify the browser that the user signed in without
115 // specifying the credential that was used. Responses to the page should
116 // provide the specified |request_id|.
117 virtual void SignedIn(int request_id, const GURL& source_url) {}
118
119 // Notifies the observer that the credential manager API was invoked from
120 // |source_url| to notify the browser that the user signed out. Responses
121 // to the page should provide the specified |request_id|.
122 virtual void SignedOut(int request_id, const GURL& source_url) {}
123
124 // Notifies the observer that the credential manager API was invoked from
125 // |source_url| to notify the browser that the user failed to sign in.
126 // |credential| specifies the credential that failed to sign in. Responses
127 // to the page should provide the specified |request_id|.
128 virtual void SignInFailed(int request_id,
129 const GURL& source_url,
130 const web::Credential& credential) {}
131
132 // Notifies the observer that the credential manager API was invoked from
133 // |source_url| to notify the browser that the user failed to sign in without
134 // specifying the credential that failed. Responses to the page should provide
135 // the specified |request_id|.
136 virtual void SignInFailed(int request_id, const GURL& source_url) {}
137
83 // Invoked when the WebState is being destroyed. Gives subclasses a chance 138 // Invoked when the WebState is being destroyed. Gives subclasses a chance
84 // to cleanup. 139 // to cleanup.
85 virtual void WebStateDestroyed() {} 140 virtual void WebStateDestroyed() {}
86 141
87 protected: 142 protected:
88 // Use this constructor when the object is tied to a single WebState for 143 // Use this constructor when the object is tied to a single WebState for
89 // its entire lifetime. 144 // its entire lifetime.
90 explicit WebStateObserver(WebState* web_state); 145 explicit WebStateObserver(WebState* web_state);
91 146
92 // Use this constructor when the object wants to observe a WebState for 147 // Use this constructor when the object wants to observe a WebState for
(...skipping 13 matching lines...) Expand all
106 void ResetWebState(); 161 void ResetWebState();
107 162
108 WebState* web_state_; 163 WebState* web_state_;
109 164
110 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); 165 DISALLOW_COPY_AND_ASSIGN(WebStateObserver);
111 }; 166 };
112 167
113 } // namespace web 168 } // namespace web
114 169
115 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ 170 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_
OLDNEW
« no previous file with comments | « ios/web/public/web_state/crw_web_view_scroll_view_proxy.h ('k') | ios/web/public/web_state/web_state_observer_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698