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

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: Fix gyp 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
« no previous file with comments | « ios/web/public/string_util.h ('k') | ios/web/string_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 web {
11
12 struct LoadCommittedDetails;
13 class WebState;
14 class WebStateImpl;
15
16 // An observer API implemented by classes which are interested in various page
17 // load events from WebState.
18 class WebStateObserver {
19 public:
20 // Returns the web state associated with this observer.
21 WebState* web_state() const { return web_state_; }
tfarina 2014/12/12 18:41:07 this is not fully const-correctness. Could you mak
stuartmorgan 2014/12/12 19:16:45 This matches WebContentsObserver's WebContents get
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) {};
tfarina 2014/12/12 18:41:07 no need of ';' in those virtual methods.
stuartmorgan 2014/12/12 19:19:57 If you find style nits in already-submitted code,
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(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(WebState* web_state);
57
58 private:
59 friend class WebStateImpl;
60
61 // Stops observing the current web state.
62 void ResetWebState();
63
64 WebState* web_state_;
65
66 DISALLOW_COPY_AND_ASSIGN(WebStateObserver);
67 };
68
69 } // namespace web
70
71 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_
OLDNEW
« no previous file with comments | « ios/web/public/string_util.h ('k') | ios/web/string_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698