OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_RENDERER_RENDER_VIEW_H_ | 5 #ifndef CHROME_RENDERER_RENDER_VIEW_H_ |
6 #define CHROME_RENDERER_RENDER_VIEW_H_ | 6 #define CHROME_RENDERER_RENDER_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/gfx/point.h" | 12 #include "base/gfx/point.h" |
13 #include "base/gfx/rect.h" | 13 #include "base/gfx/rect.h" |
| 14 #include "base/id_map.h" |
| 15 #include "base/shared_memory.h" |
14 #include "base/timer.h" | 16 #include "base/timer.h" |
15 #include "base/values.h" | 17 #include "base/values.h" |
16 #include "build/build_config.h" | 18 #include "build/build_config.h" |
17 #include "chrome/common/resource_dispatcher.h" | 19 #include "chrome/common/resource_dispatcher.h" |
18 #ifdef CHROME_PERSONALIZATION | 20 #ifdef CHROME_PERSONALIZATION |
19 #include "chrome/personalization/personalization.h" | 21 #include "chrome/personalization/personalization.h" |
20 #endif | 22 #endif |
21 #include "chrome/renderer/automation/dom_automation_controller.h" | 23 #include "chrome/renderer/automation/dom_automation_controller.h" |
22 #include "chrome/renderer/dom_ui_bindings.h" | 24 #include "chrome/renderer/dom_ui_bindings.h" |
23 #include "chrome/renderer/external_host_bindings.h" | 25 #include "chrome/renderer/external_host_bindings.h" |
24 #include "chrome/renderer/external_js_object.h" | 26 #include "chrome/renderer/external_js_object.h" |
25 #include "chrome/renderer/render_widget.h" | 27 #include "chrome/renderer/render_widget.h" |
| 28 #include "media/audio/audio_output.h" |
26 #include "testing/gtest/include/gtest/gtest_prod.h" | 29 #include "testing/gtest/include/gtest/gtest_prod.h" |
27 #include "webkit/glue/console_message_level.h" | 30 #include "webkit/glue/console_message_level.h" |
28 #include "webkit/glue/dom_serializer_delegate.h" | 31 #include "webkit/glue/dom_serializer_delegate.h" |
29 #include "webkit/glue/form_data.h" | 32 #include "webkit/glue/form_data.h" |
30 #include "webkit/glue/password_form_dom_manager.h" | 33 #include "webkit/glue/password_form_dom_manager.h" |
31 #include "webkit/glue/webview_delegate.h" | 34 #include "webkit/glue/webview_delegate.h" |
32 #include "webkit/glue/webview.h" | 35 #include "webkit/glue/webview.h" |
33 | 36 |
34 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
35 // RenderView is a diamond-shaped hierarchy, with WebWidgetDelegate at the root. | 38 // RenderView is a diamond-shaped hierarchy, with WebWidgetDelegate at the root. |
36 // VS warns when we inherit the WebWidgetDelegate method implementations from | 39 // VS warns when we inherit the WebWidgetDelegate method implementations from |
37 // RenderWidget. It's safe to ignore that warning. | 40 // RenderWidget. It's safe to ignore that warning. |
38 #pragma warning(disable: 4250) | 41 #pragma warning(disable: 4250) |
39 #endif | 42 #endif |
40 | 43 |
| 44 class AudioRendererImpl; |
41 class DictionaryValue; | 45 class DictionaryValue; |
42 class DebugMessageHandler; | 46 class DebugMessageHandler; |
43 class FilePath; | 47 class FilePath; |
44 class GlueAccessibility; | 48 class GlueAccessibility; |
45 class GURL; | 49 class GURL; |
46 class RenderThread; | 50 class RenderThread; |
47 class ResourceDispatcher; | 51 class ResourceDispatcher; |
48 class SkBitmap; | 52 class SkBitmap; |
49 class WebError; | 53 class WebError; |
50 class WebFrame; | 54 class WebFrame; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 void set_delay_seconds_for_form_state_sync(int delay_in_seconds) { | 339 void set_delay_seconds_for_form_state_sync(int delay_in_seconds) { |
336 delay_seconds_for_form_state_sync_ = delay_in_seconds; | 340 delay_seconds_for_form_state_sync_ = delay_in_seconds; |
337 } | 341 } |
338 | 342 |
339 // Returns a message loop of type IO that can be used to run I/O jobs. The | 343 // Returns a message loop of type IO that can be used to run I/O jobs. The |
340 // renderer thread is of type TYPE_DEFAULT, so doesn't support everything | 344 // renderer thread is of type TYPE_DEFAULT, so doesn't support everything |
341 // needed by some consumers. The returned thread will be the main thread of | 345 // needed by some consumers. The returned thread will be the main thread of |
342 // the renderer, which processes all IPC, to any I/O should be non-blocking. | 346 // the renderer, which processes all IPC, to any I/O should be non-blocking. |
343 MessageLoop* GetMessageLoopForIO(); | 347 MessageLoop* GetMessageLoopForIO(); |
344 | 348 |
| 349 // Register the audio renderer and try to create an audio output stream in the |
| 350 // browser process. Always return a stream id. Audio renderer will then |
| 351 // receive state change notification messages. |
| 352 int32 CreateAudioStream(AudioRendererImpl* renderer, |
| 353 AudioManager::Format format, int channels, |
| 354 int sample_rate, int bits_per_sample, |
| 355 size_t packet_size); |
| 356 void StartAudioStream(int stream_id); |
| 357 void CloseAudioStream(int stream_id); |
| 358 void NotifyAudioPacketReady(int stream_id); |
| 359 void GetAudioVolume(int stream_id); |
| 360 void SetAudioVolume(int stream_id, double left, double right); |
| 361 |
345 private: | 362 private: |
346 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); | 363 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); |
347 FRIEND_TEST(RenderViewTest, OnNavStateChanged); | 364 FRIEND_TEST(RenderViewTest, OnNavStateChanged); |
348 FRIEND_TEST(RenderViewTest, OnImeStateChanged); | 365 FRIEND_TEST(RenderViewTest, OnImeStateChanged); |
349 | 366 |
350 explicit RenderView(RenderThreadBase* render_thread); | 367 explicit RenderView(RenderThreadBase* render_thread); |
351 | 368 |
352 // Initializes this view with the given parent and ID. The |routing_id| can be | 369 // Initializes this view with the given parent and ID. The |routing_id| can be |
353 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case, | 370 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case, |
354 // CompleteInit must be called later with the true ID. | 371 // CompleteInit must be called later with the true ID. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 #endif | 534 #endif |
518 | 535 |
519 // Handles messages posted from automation. | 536 // Handles messages posted from automation. |
520 void OnMessageFromExternalHost(const std::string& target, | 537 void OnMessageFromExternalHost(const std::string& target, |
521 const std::string& message); | 538 const std::string& message); |
522 | 539 |
523 // Message that we should no longer be part of the current popup window | 540 // Message that we should no longer be part of the current popup window |
524 // grouping, and should form our own grouping. | 541 // grouping, and should form our own grouping. |
525 void OnDisassociateFromPopupCount(); | 542 void OnDisassociateFromPopupCount(); |
526 | 543 |
| 544 // Received when browser process wants more audio packet. |
| 545 void OnRequestAudioPacket(int stream_id); |
| 546 |
| 547 // Received when browser process has created an audio output stream for us. |
| 548 void OnAudioStreamCreated(int stream_id, base::SharedMemoryHandle handle, |
| 549 int length); |
| 550 |
| 551 // Received when internal state of browser process' audio output device has |
| 552 // changed. |
| 553 void OnAudioStreamStateChanged(int stream_id, AudioOutputStream::State state, |
| 554 int info); |
| 555 |
| 556 // Notification of volume property of an audio output stream. |
| 557 void OnAudioStreamVolume(int stream_id, double left, double right); |
| 558 |
527 // Switches the frame's CSS media type to "print" and calculate the number of | 559 // Switches the frame's CSS media type to "print" and calculate the number of |
528 // printed pages that are to be expected. |frame| will be used to calculate | 560 // printed pages that are to be expected. |frame| will be used to calculate |
529 // the number of expected pages for this frame only. | 561 // the number of expected pages for this frame only. |
530 int SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params, | 562 int SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params, |
531 WebFrame* frame); | 563 WebFrame* frame); |
532 | 564 |
533 // Switches the frame's CSS media type to "display". | 565 // Switches the frame's CSS media type to "display". |
534 void SwitchFrameToDisplayMediaType(WebFrame* frame); | 566 void SwitchFrameToDisplayMediaType(WebFrame* frame); |
535 | 567 |
536 // Prints the page listed in |params|. | 568 // Prints the page listed in |params|. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 // this RenderView, that it is going to be blocked until we get a message | 777 // this RenderView, that it is going to be blocked until we get a message |
746 // from the Browser process telling us otherwise. | 778 // from the Browser process telling us otherwise. |
747 bool popup_notification_visible_; | 779 bool popup_notification_visible_; |
748 | 780 |
749 // Time in seconds of the delay between syncing page state such as form | 781 // Time in seconds of the delay between syncing page state such as form |
750 // elements and scroll position. This timeout allows us to avoid spamming the | 782 // elements and scroll position. This timeout allows us to avoid spamming the |
751 // browser process with every little thing that changes. This normally doesn't | 783 // browser process with every little thing that changes. This normally doesn't |
752 // change but is overridden by tests. | 784 // change but is overridden by tests. |
753 int delay_seconds_for_form_state_sync_; | 785 int delay_seconds_for_form_state_sync_; |
754 | 786 |
| 787 // A set of audio renderers registered to use IPC for audio output. |
| 788 IDMap<AudioRendererImpl> audio_renderers_; |
| 789 |
755 DISALLOW_COPY_AND_ASSIGN(RenderView); | 790 DISALLOW_COPY_AND_ASSIGN(RenderView); |
756 }; | 791 }; |
757 | 792 |
758 #endif // CHROME_RENDERER_RENDER_VIEW_H_ | 793 #endif // CHROME_RENDERER_RENDER_VIEW_H_ |
OLD | NEW |