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" |
11 #include "base/optional.h" | 11 #include "base/optional.h" |
12 #include "base/process/kill.h" | 12 #include "base/process/kill.h" |
13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
16 #include "content/public/browser/reload_type.h" | 16 #include "content/public/browser/reload_type.h" |
17 #include "content/public/common/frame_navigate_params.h" | 17 #include "content/public/common/frame_navigate_params.h" |
18 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
20 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
21 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" | 21 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" |
22 #include "third_party/WebKit/public/web/WebInputEvent.h" | 22 #include "third_party/WebKit/public/web/WebInputEvent.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
24 #include "ui/base/page_transition_types.h" | 24 #include "ui/base/page_transition_types.h" |
25 #include "ui/base/window_open_disposition.h" | 25 #include "ui/base/window_open_disposition.h" |
26 | 26 |
| 27 namespace blink { |
| 28 namespace mojom { |
| 29 enum class MediaSessionAction; |
| 30 } |
| 31 } |
| 32 |
27 namespace content { | 33 namespace content { |
28 | 34 |
29 class NavigationEntry; | 35 class NavigationEntry; |
30 class NavigationHandle; | 36 class NavigationHandle; |
31 class RenderFrameHost; | 37 class RenderFrameHost; |
32 class RenderViewHost; | 38 class RenderViewHost; |
33 class RenderWidgetHost; | 39 class RenderWidgetHost; |
34 class WebContents; | 40 class WebContents; |
35 class WebContentsImpl; | 41 class WebContentsImpl; |
36 struct AXEventNotificationDetails; | 42 struct AXEventNotificationDetails; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 467 |
462 // Invoked when media is playing or paused. |id| is unique per player and per | 468 // Invoked when media is playing or paused. |id| is unique per player and per |
463 // RenderFrameHost. There may be multiple players within a RenderFrameHost | 469 // RenderFrameHost. There may be multiple players within a RenderFrameHost |
464 // and subsequently within a WebContents. MediaStartedPlaying() will always | 470 // and subsequently within a WebContents. MediaStartedPlaying() will always |
465 // be followed by MediaStoppedPlaying() after player teardown. Observers must | 471 // be followed by MediaStoppedPlaying() after player teardown. Observers must |
466 // release all stored copies of |id| when MediaStoppedPlaying() is received. | 472 // release all stored copies of |id| when MediaStoppedPlaying() is received. |
467 using MediaPlayerId = std::pair<RenderFrameHost*, int>; | 473 using MediaPlayerId = std::pair<RenderFrameHost*, int>; |
468 virtual void MediaStartedPlaying(const MediaPlayerId& id) {} | 474 virtual void MediaStartedPlaying(const MediaPlayerId& id) {} |
469 virtual void MediaStoppedPlaying(const MediaPlayerId& id) {} | 475 virtual void MediaStoppedPlaying(const MediaPlayerId& id) {} |
470 | 476 |
| 477 // TODO(zqzhang): Decouple MediaSession messages from WebContents to avoid |
| 478 // plumbing. See https://crbug.com/658678 |
| 479 |
471 // Invoked when media session has changed its state. | 480 // Invoked when media session has changed its state. |
472 virtual void MediaSessionStateChanged(bool is_controllable, | 481 virtual void MediaSessionStateChanged(bool is_controllable, |
473 bool is_suspended) {} | 482 bool is_suspended) {} |
474 | 483 |
475 // Invoked when media session metadata has changed. When |metadata| is | 484 // Invoked when media session metadata has changed. When |metadata| is |
476 // nullopt, it means the metadata is being unset. | 485 // nullopt, it means the metadata is being unset. |
477 virtual void MediaSessionMetadataChanged( | 486 virtual void MediaSessionMetadataChanged( |
478 const base::Optional<MediaMetadata>& metadata) {} | 487 const base::Optional<MediaMetadata>& metadata) {} |
479 | 488 |
| 489 // Invoked when media session action is enabled. |
| 490 virtual void MediaSessionEnabledAction( |
| 491 blink::mojom::MediaSessionAction action) {} |
| 492 |
| 493 // Invoked when media session action is disabled. |
| 494 virtual void MediaSessionDisabledAction( |
| 495 blink::mojom::MediaSessionAction action) {} |
| 496 |
480 // Invoked when the renderer process changes the page scale factor. | 497 // Invoked when the renderer process changes the page scale factor. |
481 virtual void OnPageScaleFactorChanged(float page_scale_factor) {} | 498 virtual void OnPageScaleFactorChanged(float page_scale_factor) {} |
482 | 499 |
483 // Invoked if an IPC message is coming from a specific RenderFrameHost. | 500 // Invoked if an IPC message is coming from a specific RenderFrameHost. |
484 virtual bool OnMessageReceived(const IPC::Message& message, | 501 virtual bool OnMessageReceived(const IPC::Message& message, |
485 RenderFrameHost* render_frame_host); | 502 RenderFrameHost* render_frame_host); |
486 | 503 |
487 // Notification that |contents| has gained focus. | 504 // Notification that |contents| has gained focus. |
488 virtual void OnWebContentsFocused() {} | 505 virtual void OnWebContentsFocused() {} |
489 | 506 |
(...skipping 27 matching lines...) Expand all Loading... |
517 void ResetWebContents(); | 534 void ResetWebContents(); |
518 | 535 |
519 WebContentsImpl* web_contents_; | 536 WebContentsImpl* web_contents_; |
520 | 537 |
521 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 538 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
522 }; | 539 }; |
523 | 540 |
524 } // namespace content | 541 } // namespace content |
525 | 542 |
526 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 543 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |