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

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

Issue 780873002: Upstream iOS web code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_
7
8 #include "base/macros.h"
9
10 namespace ios {
11 class WebState;
12 }
13
14 namespace web {
15
16 struct LoadCommittedDetails;
17
18 class WebStateObserver {
stuartmorgan 2014/12/04 23:22:58 Whoops :( Could you add a class-level comment whil
19 public:
20 // Returns the web state associated with this observer.
21 ios::WebState* web_state() const { return web_state_; }
22
23 // This method is invoked when a new non-pending navigation item is created.
24 // This corresponds to one NavigationManager item being created
25 // (in the case of new navigations) or renavigated to (for back/forward
26 // navigations).
27 virtual void NavigationItemCommitted(
28 const LoadCommittedDetails& load_details) {};
29
30 // Called when the current page is loaded.
31 virtual void PageLoaded() {};
32
33 // Called on URL hash change events.
34 virtual void URLHashChanged() {};
35
36 // Called on history state change events.
37 virtual void HistoryStateChanged() {};
38
39 // Invoked when the WebState is being destroyed. Gives subclasses a chance
40 // to cleanup.
41 virtual void WebStateDestroyed() {}
42
43 protected:
44 // Use this constructor when the object is tied to a single WebState for
45 // its entire lifetime.
46 explicit WebStateObserver(ios::WebState* web_state);
47
48 // Use this constructor when the object wants to observe a WebState for
49 // part of its lifetime. It can then call Observe() to start and stop
50 // observing.
51 WebStateObserver();
52
53 virtual ~WebStateObserver();
54
55 // Start observing a different WebState; used with the default constructor.
56 void Observe(ios::WebState* web_state);
57
58 private:
59 friend class WebStateImpl;
stuartmorgan 2014/12/04 23:22:58 Shouldn't there be a forward declaration for this
60
61 // Stops observing the current web state.
62 void ResetWebState();
63
64 ios::WebState* web_state_;
65
66 DISALLOW_COPY_AND_ASSIGN(WebStateObserver);
67 };
68
69 } // namespace web
70
71 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698