| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 15 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
| 16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 19 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 20 #include "base/string_piece.h" | 21 #include "base/string_piece.h" |
| 21 #include "base/string_split.h" | 22 #include "base/string_split.h" |
| (...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 FOR_EACH_OBSERVER( | 1978 FOR_EACH_OBSERVER( |
| 1978 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 1979 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
| 1979 | 1980 |
| 1980 scoped_ptr<media::MessageLoopFactory> message_loop_factory( | 1981 scoped_ptr<media::MessageLoopFactory> message_loop_factory( |
| 1981 new media::MessageLoopFactoryImpl()); | 1982 new media::MessageLoopFactoryImpl()); |
| 1982 scoped_ptr<media::FilterCollection> collection( | 1983 scoped_ptr<media::FilterCollection> collection( |
| 1983 new media::FilterCollection()); | 1984 new media::FilterCollection()); |
| 1984 | 1985 |
| 1985 // Add in any custom filter factories first. | 1986 // Add in any custom filter factories first. |
| 1986 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1987 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 1988 AudioRendererImpl* audio_renderer = NULL; |
| 1987 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 1989 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
| 1988 // Add the chrome specific audio renderer. | 1990 // Add the chrome specific audio renderer. |
| 1989 collection->AddAudioRenderer(new AudioRendererImpl()); | 1991 audio_renderer = new AudioRendererImpl(MessageLoop::current()); |
| 1992 collection->AddAudioRenderer(audio_renderer); |
| 1990 } | 1993 } |
| 1991 | 1994 |
| 1992 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; | 1995 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; |
| 1993 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); | 1996 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); |
| 1994 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( | 1997 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( |
| 1995 new webkit_glue::VideoRendererImpl(pts_logging)); | 1998 new webkit_glue::VideoRendererImpl(pts_logging)); |
| 1996 collection->AddVideoRenderer(renderer); | 1999 collection->AddVideoRenderer(renderer); |
| 1997 video_renderer = renderer; | 2000 video_renderer = renderer; |
| 1998 | 2001 |
| 1999 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( | 2002 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( |
| 2000 new webkit_glue::WebMediaPlayerImpl(client, | 2003 new webkit_glue::WebMediaPlayerImpl(client, |
| 2001 collection.release(), | 2004 collection.release(), |
| 2005 audio_renderer, |
| 2002 message_loop_factory.release(), | 2006 message_loop_factory.release(), |
| 2003 media_stream_impl_.get(), | 2007 media_stream_impl_.get(), |
| 2004 new RenderMediaLog())); | 2008 new RenderMediaLog())); |
| 2005 if (!result->Initialize(frame, | 2009 if (!result->Initialize(frame, |
| 2006 cmd_line->HasSwitch(switches::kSimpleDataSource), | 2010 cmd_line->HasSwitch(switches::kSimpleDataSource), |
| 2007 video_renderer)) { | 2011 video_renderer)) { |
| 2008 return NULL; | 2012 return NULL; |
| 2009 } | 2013 } |
| 2010 return result.release(); | 2014 return result.release(); |
| 2011 } | 2015 } |
| (...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4551 } | 4555 } |
| 4552 #endif | 4556 #endif |
| 4553 | 4557 |
| 4554 void RenderView::OnContextMenuClosed( | 4558 void RenderView::OnContextMenuClosed( |
| 4555 const webkit_glue::CustomContextMenuContext& custom_context) { | 4559 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4556 if (custom_context.is_pepper_menu) | 4560 if (custom_context.is_pepper_menu) |
| 4557 pepper_delegate_.OnContextMenuClosed(custom_context); | 4561 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4558 else | 4562 else |
| 4559 context_menu_node_.reset(); | 4563 context_menu_node_.reset(); |
| 4560 } | 4564 } |
| OLD | NEW |