| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 virtual bool OnMessageReceived(const IPC::Message& message, | 329 virtual bool OnMessageReceived(const IPC::Message& message, |
| 330 RenderFrameHost* render_frame_host); | 330 RenderFrameHost* render_frame_host); |
| 331 | 331 |
| 332 // IPC::Listener implementation. | 332 // IPC::Listener implementation. |
| 333 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 333 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 334 | 334 |
| 335 // IPC::Sender implementation. | 335 // IPC::Sender implementation. |
| 336 virtual bool Send(IPC::Message* message) OVERRIDE; | 336 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 337 int routing_id() const; | 337 int routing_id() const; |
| 338 | 338 |
| 339 WebContents* web_contents() const; |
| 340 |
| 339 protected: | 341 protected: |
| 340 // Use this constructor when the object is tied to a single WebContents for | 342 // Use this constructor when the object is tied to a single WebContents for |
| 341 // its entire lifetime. | 343 // its entire lifetime. |
| 342 explicit WebContentsObserver(WebContents* web_contents); | 344 explicit WebContentsObserver(WebContents* web_contents); |
| 343 | 345 |
| 344 // Use this constructor when the object wants to observe a WebContents for | 346 // Use this constructor when the object wants to observe a WebContents for |
| 345 // part of its lifetime. It can then call Observe() to start and stop | 347 // part of its lifetime. It can then call Observe() to start and stop |
| 346 // observing. | 348 // observing. |
| 347 WebContentsObserver(); | 349 WebContentsObserver(); |
| 348 | 350 |
| 349 virtual ~WebContentsObserver(); | 351 virtual ~WebContentsObserver(); |
| 350 | 352 |
| 351 // Start observing a different WebContents; used with the default constructor. | 353 // Start observing a different WebContents; used with the default constructor. |
| 352 void Observe(WebContents* web_contents); | 354 void Observe(WebContents* web_contents); |
| 353 | 355 |
| 354 WebContents* web_contents() const; | |
| 355 | |
| 356 private: | 356 private: |
| 357 friend class WebContentsImpl; | 357 friend class WebContentsImpl; |
| 358 | 358 |
| 359 void ResetWebContents(); | 359 void ResetWebContents(); |
| 360 | 360 |
| 361 WebContentsImpl* web_contents_; | 361 WebContentsImpl* web_contents_; |
| 362 | 362 |
| 363 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 363 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
| 364 }; | 364 }; |
| 365 | 365 |
| 366 } // namespace content | 366 } // namespace content |
| 367 | 367 |
| 368 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 368 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |