| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 webkit_glue::kForegroundTabTimerInterval); | 397 webkit_glue::kForegroundTabTimerInterval); |
| 398 | 398 |
| 399 OnSetRendererPrefs(renderer_prefs); | 399 OnSetRendererPrefs(renderer_prefs); |
| 400 | 400 |
| 401 host_window_ = parent_hwnd; | 401 host_window_ = parent_hwnd; |
| 402 | 402 |
| 403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 404 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 404 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
| 405 WebAccessibilityCache::enableAccessibility(); | 405 WebAccessibilityCache::enableAccessibility(); |
| 406 | 406 |
| 407 audio_message_filter_ = new AudioMessageFilter(routing_id_); | |
| 408 render_thread_->AddFilter(audio_message_filter_); | |
| 409 | |
| 410 #if defined(ENABLE_P2P_APIS) | 407 #if defined(ENABLE_P2P_APIS) |
| 411 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableP2PApi)) | 408 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableP2PApi)) |
| 412 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); | 409 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); |
| 413 #endif | 410 #endif |
| 414 | 411 |
| 415 content::GetContentClient()->renderer()->RenderViewCreated(this); | 412 content::GetContentClient()->renderer()->RenderViewCreated(this); |
| 416 } | 413 } |
| 417 | 414 |
| 418 RenderView::~RenderView() { | 415 RenderView::~RenderView() { |
| 419 if (decrement_shared_popup_at_destruction_) | 416 if (decrement_shared_popup_at_destruction_) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 431 #if defined(OS_MACOSX) | 428 #if defined(OS_MACOSX) |
| 432 // Destroy all fake plugin window handles on the browser side. | 429 // Destroy all fake plugin window handles on the browser side. |
| 433 while (!fake_plugin_window_handles_.empty()) { | 430 while (!fake_plugin_window_handles_.empty()) { |
| 434 // Make sure no NULL plugin window handles were inserted into this list. | 431 // Make sure no NULL plugin window handles were inserted into this list. |
| 435 DCHECK(*fake_plugin_window_handles_.begin()); | 432 DCHECK(*fake_plugin_window_handles_.begin()); |
| 436 // DestroyFakePluginWindowHandle modifies fake_plugin_window_handles_. | 433 // DestroyFakePluginWindowHandle modifies fake_plugin_window_handles_. |
| 437 DestroyFakePluginWindowHandle(*fake_plugin_window_handles_.begin()); | 434 DestroyFakePluginWindowHandle(*fake_plugin_window_handles_.begin()); |
| 438 } | 435 } |
| 439 #endif | 436 #endif |
| 440 | 437 |
| 441 render_thread_->RemoveFilter(audio_message_filter_); | |
| 442 | |
| 443 #ifndef NDEBUG | 438 #ifndef NDEBUG |
| 444 // Make sure we are no longer referenced by the ViewMap. | 439 // Make sure we are no longer referenced by the ViewMap. |
| 445 ViewMap* views = g_view_map.Pointer(); | 440 ViewMap* views = g_view_map.Pointer(); |
| 446 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) | 441 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) |
| 447 DCHECK_NE(this, it->second) << "Failed to call Close?"; | 442 DCHECK_NE(this, it->second) << "Failed to call Close?"; |
| 448 #endif | 443 #endif |
| 449 | 444 |
| 450 FOR_EACH_OBSERVER(RenderViewObserver, observers_, set_render_view(NULL)); | 445 FOR_EACH_OBSERVER(RenderViewObserver, observers_, set_render_view(NULL)); |
| 451 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnDestruct()); | 446 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnDestruct()); |
| 452 } | 447 } |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 return WebStorageNamespace::createSessionStorageNamespace(quota); | 1342 return WebStorageNamespace::createSessionStorageNamespace(quota); |
| 1348 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1343 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
| 1349 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION, | 1344 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION, |
| 1350 session_storage_namespace_id_); | 1345 session_storage_namespace_id_); |
| 1351 } | 1346 } |
| 1352 | 1347 |
| 1353 void RenderView::didAddMessageToConsole( | 1348 void RenderView::didAddMessageToConsole( |
| 1354 const WebConsoleMessage& message, const WebString& source_name, | 1349 const WebConsoleMessage& message, const WebString& source_name, |
| 1355 unsigned source_line) { | 1350 unsigned source_line) { |
| 1356 logging::LogSeverity log_severity = logging::LOG_VERBOSE; | 1351 logging::LogSeverity log_severity = logging::LOG_VERBOSE; |
| 1357 switch(message.level) { | 1352 switch (message.level) { |
| 1358 case WebConsoleMessage::LevelTip: | 1353 case WebConsoleMessage::LevelTip: |
| 1359 log_severity = logging::LOG_VERBOSE; | 1354 log_severity = logging::LOG_VERBOSE; |
| 1360 break; | 1355 break; |
| 1361 case WebConsoleMessage::LevelLog: | 1356 case WebConsoleMessage::LevelLog: |
| 1362 log_severity = logging::LOG_INFO; | 1357 log_severity = logging::LOG_INFO; |
| 1363 break; | 1358 break; |
| 1364 case WebConsoleMessage::LevelWarning: | 1359 case WebConsoleMessage::LevelWarning: |
| 1365 log_severity = logging::LOG_WARNING; | 1360 log_severity = logging::LOG_WARNING; |
| 1366 break; | 1361 break; |
| 1367 case WebConsoleMessage::LevelError: | 1362 case WebConsoleMessage::LevelError: |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 | 1879 |
| 1885 scoped_ptr<media::MessageLoopFactory> message_loop_factory( | 1880 scoped_ptr<media::MessageLoopFactory> message_loop_factory( |
| 1886 new media::MessageLoopFactoryImpl()); | 1881 new media::MessageLoopFactoryImpl()); |
| 1887 scoped_ptr<media::FilterCollection> collection( | 1882 scoped_ptr<media::FilterCollection> collection( |
| 1888 new media::FilterCollection()); | 1883 new media::FilterCollection()); |
| 1889 | 1884 |
| 1890 // Add in any custom filter factories first. | 1885 // Add in any custom filter factories first. |
| 1891 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1886 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 1892 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 1887 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
| 1893 // Add the chrome specific audio renderer. | 1888 // Add the chrome specific audio renderer. |
| 1894 collection->AddAudioRenderer(new AudioRendererImpl(audio_message_filter())); | 1889 collection->AddAudioRenderer(new AudioRendererImpl()); |
| 1895 } | 1890 } |
| 1896 | 1891 |
| 1897 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; | 1892 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; |
| 1898 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); | 1893 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); |
| 1899 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( | 1894 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( |
| 1900 new webkit_glue::VideoRendererImpl(pts_logging)); | 1895 new webkit_glue::VideoRendererImpl(pts_logging)); |
| 1901 collection->AddVideoRenderer(renderer); | 1896 collection->AddVideoRenderer(renderer); |
| 1902 video_renderer = renderer; | 1897 video_renderer = renderer; |
| 1903 | 1898 |
| 1904 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( | 1899 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4255 const webkit_glue::CustomContextMenuContext& custom_context) { | 4250 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4256 if (custom_context.is_pepper_menu) | 4251 if (custom_context.is_pepper_menu) |
| 4257 pepper_delegate_.OnContextMenuClosed(custom_context); | 4252 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4258 else | 4253 else |
| 4259 context_menu_node_.reset(); | 4254 context_menu_node_.reset(); |
| 4260 } | 4255 } |
| 4261 | 4256 |
| 4262 void RenderView::OnNetworkStateChanged(bool online) { | 4257 void RenderView::OnNetworkStateChanged(bool online) { |
| 4263 WebNetworkStateNotifier::setOnLine(online); | 4258 WebNetworkStateNotifier::setOnLine(online); |
| 4264 } | 4259 } |
| OLD | NEW |