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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 class RenderFrameHost; | 31 class RenderFrameHost; |
32 class RenderViewHost; | 32 class RenderViewHost; |
33 class RenderWidgetHost; | 33 class RenderWidgetHost; |
34 class WebContents; | 34 class WebContents; |
35 class WebContentsImpl; | 35 class WebContentsImpl; |
36 struct AXEventNotificationDetails; | 36 struct AXEventNotificationDetails; |
37 struct AXLocationChangeNotificationDetails; | 37 struct AXLocationChangeNotificationDetails; |
38 struct FaviconURL; | 38 struct FaviconURL; |
39 struct FrameNavigateParams; | 39 struct FrameNavigateParams; |
40 struct LoadCommittedDetails; | 40 struct LoadCommittedDetails; |
41 struct MediaMetadata; | |
42 struct Referrer; | 41 struct Referrer; |
43 struct ResourceRedirectDetails; | 42 struct ResourceRedirectDetails; |
44 struct ResourceRequestDetails; | 43 struct ResourceRequestDetails; |
45 struct SecurityStyleExplanations; | 44 struct SecurityStyleExplanations; |
46 | 45 |
47 // An observer API implemented by classes which are interested in various page | 46 // An observer API implemented by classes which are interested in various page |
48 // load events from WebContents. They also get a chance to filter IPC messages. | 47 // load events from WebContents. They also get a chance to filter IPC messages. |
49 // | 48 // |
50 // Since a WebContents can be a delegate to almost arbitrarily many | 49 // Since a WebContents can be a delegate to almost arbitrarily many |
51 // RenderViewHosts, it is important to check in those WebContentsObserver | 50 // RenderViewHosts, it is important to check in those WebContentsObserver |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 460 |
462 // Invoked when media is playing or paused. |id| is unique per player and per | 461 // Invoked when media is playing or paused. |id| is unique per player and per |
463 // RenderFrameHost. There may be multiple players within a RenderFrameHost | 462 // RenderFrameHost. There may be multiple players within a RenderFrameHost |
464 // and subsequently within a WebContents. MediaStartedPlaying() will always | 463 // and subsequently within a WebContents. MediaStartedPlaying() will always |
465 // be followed by MediaStoppedPlaying() after player teardown. Observers must | 464 // be followed by MediaStoppedPlaying() after player teardown. Observers must |
466 // release all stored copies of |id| when MediaStoppedPlaying() is received. | 465 // release all stored copies of |id| when MediaStoppedPlaying() is received. |
467 using MediaPlayerId = std::pair<RenderFrameHost*, int>; | 466 using MediaPlayerId = std::pair<RenderFrameHost*, int>; |
468 virtual void MediaStartedPlaying(const MediaPlayerId& id) {} | 467 virtual void MediaStartedPlaying(const MediaPlayerId& id) {} |
469 virtual void MediaStoppedPlaying(const MediaPlayerId& id) {} | 468 virtual void MediaStoppedPlaying(const MediaPlayerId& id) {} |
470 | 469 |
471 // Invoked when media session has changed its state. | |
472 virtual void MediaSessionStateChanged(bool is_controllable, | |
473 bool is_suspended) {} | |
474 | |
475 // Invoked when media session metadata has changed. When |metadata| is | |
476 // nullopt, it means the metadata is being unset. | |
477 virtual void MediaSessionMetadataChanged( | |
478 const base::Optional<MediaMetadata>& metadata) {} | |
479 | |
480 // Invoked when the renderer process changes the page scale factor. | 470 // Invoked when the renderer process changes the page scale factor. |
481 virtual void OnPageScaleFactorChanged(float page_scale_factor) {} | 471 virtual void OnPageScaleFactorChanged(float page_scale_factor) {} |
482 | 472 |
483 // Invoked if an IPC message is coming from a specific RenderFrameHost. | 473 // Invoked if an IPC message is coming from a specific RenderFrameHost. |
484 virtual bool OnMessageReceived(const IPC::Message& message, | 474 virtual bool OnMessageReceived(const IPC::Message& message, |
485 RenderFrameHost* render_frame_host); | 475 RenderFrameHost* render_frame_host); |
486 | 476 |
487 // Notification that |contents| has gained focus. | 477 // Notification that |contents| has gained focus. |
488 virtual void OnWebContentsFocused() {} | 478 virtual void OnWebContentsFocused() {} |
489 | 479 |
(...skipping 27 matching lines...) Expand all Loading... |
517 void ResetWebContents(); | 507 void ResetWebContents(); |
518 | 508 |
519 WebContentsImpl* web_contents_; | 509 WebContentsImpl* web_contents_; |
520 | 510 |
521 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 511 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
522 }; | 512 }; |
523 | 513 |
524 } // namespace content | 514 } // namespace content |
525 | 515 |
526 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 516 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |