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/process/kill.h" | 12 #include "base/process/kill.h" |
12 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
14 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
15 #include "content/public/common/frame_navigate_params.h" | 16 #include "content/public/common/frame_navigate_params.h" |
16 #include "content/public/common/media_metadata.h" | |
17 #include "content/public/common/resource_type.h" | 17 #include "content/public/common/resource_type.h" |
18 #include "content/public/common/security_style.h" | 18 #include "content/public/common/security_style.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/web/WebInputEvent.h" | 21 #include "third_party/WebKit/public/web/WebInputEvent.h" |
22 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
23 #include "ui/base/page_transition_types.h" | 23 #include "ui/base/page_transition_types.h" |
24 #include "ui/base/window_open_disposition.h" | 24 #include "ui/base/window_open_disposition.h" |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 class NavigationEntry; | 28 class NavigationEntry; |
29 class NavigationHandle; | 29 class NavigationHandle; |
30 class RenderFrameHost; | 30 class RenderFrameHost; |
31 class RenderViewHost; | 31 class RenderViewHost; |
32 class RenderWidgetHost; | 32 class RenderWidgetHost; |
33 class WebContents; | 33 class WebContents; |
34 class WebContentsImpl; | 34 class WebContentsImpl; |
35 struct AXEventNotificationDetails; | 35 struct AXEventNotificationDetails; |
36 struct AXLocationChangeNotificationDetails; | 36 struct AXLocationChangeNotificationDetails; |
37 struct FaviconURL; | 37 struct FaviconURL; |
38 struct FrameNavigateParams; | 38 struct FrameNavigateParams; |
39 struct LoadCommittedDetails; | 39 struct LoadCommittedDetails; |
| 40 struct MediaMetadata; |
40 struct Referrer; | 41 struct Referrer; |
41 struct ResourceRedirectDetails; | 42 struct ResourceRedirectDetails; |
42 struct ResourceRequestDetails; | 43 struct ResourceRequestDetails; |
43 struct SecurityStyleExplanations; | 44 struct SecurityStyleExplanations; |
44 | 45 |
45 // 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 |
46 // 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. |
47 // | 48 // |
48 // Since a WebContents can be a delegate to almost arbitrarily many | 49 // Since a WebContents can be a delegate to almost arbitrarily many |
49 // RenderViewHosts, it is important to check in those WebContentsObserver | 50 // RenderViewHosts, it is important to check in those WebContentsObserver |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // Invoked when media is playing or paused. |id| is unique per player and per | 463 // Invoked when media is playing or paused. |id| is unique per player and per |
463 // RenderFrameHost. There may be multiple players within a RenderFrameHost | 464 // RenderFrameHost. There may be multiple players within a RenderFrameHost |
464 // and subsequently within a WebContents. MediaStartedPlaying() will always | 465 // and subsequently within a WebContents. MediaStartedPlaying() will always |
465 // be followed by MediaStoppedPlaying() after player teardown. Observers must | 466 // be followed by MediaStoppedPlaying() after player teardown. Observers must |
466 // release all stored copies of |id| when MediaStoppedPlaying() is received. | 467 // release all stored copies of |id| when MediaStoppedPlaying() is received. |
467 using MediaPlayerId = std::pair<RenderFrameHost*, int>; | 468 using MediaPlayerId = std::pair<RenderFrameHost*, int>; |
468 virtual void MediaStartedPlaying(const MediaPlayerId& id) {} | 469 virtual void MediaStartedPlaying(const MediaPlayerId& id) {} |
469 virtual void MediaStoppedPlaying(const MediaPlayerId& id) {} | 470 virtual void MediaStoppedPlaying(const MediaPlayerId& id) {} |
470 | 471 |
471 // Invoked when media session has changed its state. | 472 // Invoked when media session has changed its state. |
472 virtual void MediaSessionStateChanged(bool is_controllable, | 473 virtual void MediaSessionStateChanged( |
473 bool is_suspended, | 474 bool is_controllable, |
474 const MediaMetadata& metadata) {} | 475 bool is_suspended, |
| 476 const base::Optional<MediaMetadata>& metadata) {} |
475 | 477 |
476 // Invoked when the renderer process changes the page scale factor. | 478 // Invoked when the renderer process changes the page scale factor. |
477 virtual void OnPageScaleFactorChanged(float page_scale_factor) {} | 479 virtual void OnPageScaleFactorChanged(float page_scale_factor) {} |
478 | 480 |
479 // Invoked if an IPC message is coming from a specific RenderFrameHost. | 481 // Invoked if an IPC message is coming from a specific RenderFrameHost. |
480 virtual bool OnMessageReceived(const IPC::Message& message, | 482 virtual bool OnMessageReceived(const IPC::Message& message, |
481 RenderFrameHost* render_frame_host); | 483 RenderFrameHost* render_frame_host); |
482 | 484 |
483 // Notification that |contents| has gained focus. | 485 // Notification that |contents| has gained focus. |
484 virtual void OnWebContentsFocused() {} | 486 virtual void OnWebContentsFocused() {} |
(...skipping 28 matching lines...) Expand all Loading... |
513 void ResetWebContents(); | 515 void ResetWebContents(); |
514 | 516 |
515 WebContentsImpl* web_contents_; | 517 WebContentsImpl* web_contents_; |
516 | 518 |
517 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 519 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
518 }; | 520 }; |
519 | 521 |
520 } // namespace content | 522 } // namespace content |
521 | 523 |
522 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 524 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |