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

Side by Side Diff: content/browser/tab_contents/tab_contents_observer.h

Issue 7057036: Add some missing information to TabContentsObserver docs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_
7 7
8 #include "content/browser/tab_contents/navigation_controller.h" 8 #include "content/browser/tab_contents/navigation_controller.h"
9 #include "content/common/page_transition_types.h" 9 #include "content/common/page_transition_types.h"
10 #include "ipc/ipc_channel.h" 10 #include "ipc/ipc_channel.h"
11 #include "webkit/glue/window_open_disposition.h" 11 #include "webkit/glue/window_open_disposition.h"
12 12
13 class RenderViewHost; 13 class RenderViewHost;
14 struct ViewHostMsg_FrameNavigate_Params; 14 struct ViewHostMsg_FrameNavigate_Params;
15 15
16 // An observer API implemented by classes which are interested in various page 16 // An observer API implemented by classes which are interested in various page
17 // load events from TabContents. They also get a chance to filter IPC messages. 17 // load events from TabContents. They also get a chance to filter IPC messages.
18 class TabContentsObserver : public IPC::Channel::Listener, 18 class TabContentsObserver : public IPC::Channel::Listener,
19 public IPC::Message::Sender { 19 public IPC::Message::Sender {
20 public: 20 public:
21 // Use this as a member variable in a class that uses the empty constructor 21 // Use this as a member variable in a class that uses the empty constructor
22 // version of this interface. 22 // version of this interface. On destruction of TabContents being observed,
23 // the registrar must either be destroyed or explicitly set to observe
24 // another TabContents.
23 class Registrar { 25 class Registrar {
24 public: 26 public:
25 explicit Registrar(TabContentsObserver* observer); 27 explicit Registrar(TabContentsObserver* observer);
26 ~Registrar(); 28 ~Registrar();
27 29
28 // Call this to start observing a tab. Passing in NULL resets it. 30 // Call this to start observing a tab. Passing in NULL resets it.
29 // This can only be used to watch one tab at a time. If you call this and 31 // This can only be used to watch one tab at a time. If you call this and
30 // you're already observing another tab, the old tab won't be observed 32 // you're already observing another tab, the old tab won't be observed
31 // afterwards. 33 // afterwards.
32 void Observe(TabContents* tab); 34 void Observe(TabContents* tab);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 119
118 // IPC::Message::Sender implementation. 120 // IPC::Message::Sender implementation.
119 virtual bool Send(IPC::Message* message); 121 virtual bool Send(IPC::Message* message);
120 122
121 TabContents* tab_contents() const { return tab_contents_; } 123 TabContents* tab_contents() const { return tab_contents_; }
122 int routing_id() const; 124 int routing_id() const;
123 125
124 protected: 126 protected:
125 friend class Registrar; 127 friend class Registrar;
126 128
129 // Called from TabContents in response to having |this| added as an observer.
127 void SetTabContents(TabContents* tab_contents); 130 void SetTabContents(TabContents* tab_contents);
128 131
129 private: 132 private:
130 friend class TabContents; 133 friend class TabContents;
131 134
132 // Invoked from TabContents. Invokes TabContentsDestroyed and NULL out 135 // Invoked from TabContents. Invokes TabContentsDestroyed and NULL out
133 // |tab_contents_|. 136 // |tab_contents_|.
134 void TabContentsDestroyed(); 137 void TabContentsDestroyed();
135 138
136 TabContents* tab_contents_; 139 TabContents* tab_contents_;
137 140
138 // The routing ID of the associated TabContents. 141 // The routing ID of the associated TabContents.
139 int routing_id_; 142 int routing_id_;
140 143
141 DISALLOW_COPY_AND_ASSIGN(TabContentsObserver); 144 DISALLOW_COPY_AND_ASSIGN(TabContentsObserver);
142 }; 145 };
143 146
144 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ 147 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698