Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
| 9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 // that this ID is supplied by the renderer, so should be validated before | 285 // that this ID is supplied by the renderer, so should be validated before |
| 286 // it's used for anything in case there's an exploited renderer. | 286 // it's used for anything in case there's an exploited renderer. |
| 287 virtual void PluginHungStatusChanged(int plugin_child_id, | 287 virtual void PluginHungStatusChanged(int plugin_child_id, |
| 288 const base::FilePath& plugin_path, | 288 const base::FilePath& plugin_path, |
| 289 bool is_hung) {} | 289 bool is_hung) {} |
| 290 | 290 |
| 291 // Invoked when WebContents::Clone() was used to clone a WebContents. | 291 // Invoked when WebContents::Clone() was used to clone a WebContents. |
| 292 virtual void DidCloneToNewWebContents(WebContents* old_web_contents, | 292 virtual void DidCloneToNewWebContents(WebContents* old_web_contents, |
| 293 WebContents* new_web_contents) {} | 293 WebContents* new_web_contents) {} |
| 294 | 294 |
| 295 // Invoked when the WebContents is being destroyed. Gives subclasses a chance | 295 // When WebContents is being destroyed it notifies its observers and this |
| 296 // to cleanup. At the time this is invoked |web_contents()| returns NULL. | 296 // process is split in two phases (untrusted and trusted). |
|
jam
2014/05/02 19:34:11
this trusted and untrusted terminology is a bit co
zverre
2014/05/05 16:40:25
Done.
| |
| 297 // It is safe to delete 'this' from here. | 297 // First WebContents loops through its observers and calls |
| 298 virtual void WebContentsDestroyed(WebContents* web_contents) {} | 298 // WebContentsDestroyed to let them run cleanup code. At the time this is |
| 299 // invoked |web_contents()| is guaranteed to be non NULL for all | |
| 300 // WebContentsObservers so they can directly or indirectly call each other. | |
| 301 // It is safe to delete 'this' from here. When this loop has been finished | |
| 302 // trusted phase starts, WebContents loops its WebContentsObservers again | |
| 303 // and NULLs its |web_contents_| pointers. This is done by calling | |
| 304 // WebContentsDestroyed and this behavior can't be modified since it is | |
| 305 // private. | |
| 306 virtual void WebContentsDestroyed() {} | |
| 299 | 307 |
| 300 // Called when the user agent override for a WebContents has been changed. | 308 // Called when the user agent override for a WebContents has been changed. |
| 301 virtual void UserAgentOverrideSet(const std::string& user_agent) {} | 309 virtual void UserAgentOverrideSet(const std::string& user_agent) {} |
| 302 | 310 |
| 303 // Invoked when new FaviconURL candidates are received from the renderer. | 311 // Invoked when new FaviconURL candidates are received from the renderer. |
| 304 virtual void DidUpdateFaviconURL(int32 page_id, | 312 virtual void DidUpdateFaviconURL(int32 page_id, |
| 305 const std::vector<FaviconURL>& candidates) {} | 313 const std::vector<FaviconURL>& candidates) {} |
| 306 | 314 |
| 307 // Invoked when a pepper plugin creates and shows or destroys a fullscreen | 315 // Invoked when a pepper plugin creates and shows or destroys a fullscreen |
| 308 // render widget. | 316 // render widget. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 virtual ~WebContentsObserver(); | 360 virtual ~WebContentsObserver(); |
| 353 | 361 |
| 354 // Start observing a different WebContents; used with the default constructor. | 362 // Start observing a different WebContents; used with the default constructor. |
| 355 void Observe(WebContents* web_contents); | 363 void Observe(WebContents* web_contents); |
| 356 | 364 |
| 357 WebContents* web_contents() const; | 365 WebContents* web_contents() const; |
| 358 | 366 |
| 359 private: | 367 private: |
| 360 friend class WebContentsImpl; | 368 friend class WebContentsImpl; |
| 361 | 369 |
| 362 // Invoked from WebContentsImpl. Invokes WebContentsDestroyed and NULL out | 370 // Resets |web_contents_| pointer to NULL as a final step in the process |
| 363 // |web_contents_|. | 371 // of destroying the WebContents. See comments near WebContentsDestroyed. |
| 364 void WebContentsImplDestroyed(); | 372 void WebContentsDestroyedPrivate() { web_contents_ = NULL; } |
|
jam
2014/05/02 19:34:11
nit: since it's inline and it's a simple method, i
zverre
2014/05/05 12:40:43
Jam, thank you for your comments. I don't really w
jam
2014/05/05 15:05:03
ok sure. i don't feel strongly about it (btw for t
zverre
2014/05/05 16:40:25
Done.
| |
| 365 | 373 |
| 366 WebContentsImpl* web_contents_; | 374 WebContentsImpl* web_contents_; |
| 367 | 375 |
| 368 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 376 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
| 369 }; | 377 }; |
| 370 | 378 |
| 371 } // namespace content | 379 } // namespace content |
| 372 | 380 |
| 373 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 381 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |