summaryrefslogtreecommitdiffstats
path: root/chrome/service/service_process.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/service/service_process.cc')
-rw-r--r--chrome/service/service_process.cc26
1 files changed, 23 insertions, 3 deletions
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc
index f490fb5..c46bb97 100644
--- a/chrome/service/service_process.cc
+++ b/chrome/service/service_process.cc
@@ -27,6 +27,7 @@
#include "chrome/service/service_process_prefs.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
+#include "media/base/media.h"
#include "net/base/network_change_notifier.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -34,6 +35,9 @@
#if defined(ENABLE_REMOTING)
#include "chrome/service/remoting/chromoting_host_manager.h"
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#endif // defined(OS_MACOSX)
#endif // defined(ENABLED_REMOTING)
ServiceProcess* g_service_process = NULL;
@@ -160,11 +164,25 @@ bool ServiceProcess::Initialize(MessageLoop* message_loop,
PrepareRestartOnCrashEnviroment(command_line);
#if defined(ENABLE_REMOTING)
+ // Load media codecs, required by the Chromoting host
+ bool initialized_media_library = false;
+#if defined(OS_MACOSX)
+ FilePath bundle_path = base::mac::MainAppBundlePath();
+
+ initialized_media_library =
+ media::InitializeMediaLibrary(bundle_path.Append("Libraries"));
+#else
+ FilePath module_path;
+ initialized_media_library =
+ PathService::Get(base::DIR_MODULE, &module_path) &&
+ media::InitializeMediaLibrary(module_path);
+#endif
+
// Initialize chromoting host manager.
remoting_host_manager_ = new remoting::ChromotingHostManager(this);
remoting_host_manager_->Initialize(message_loop,
file_thread_->message_loop_proxy());
-#endif
+#endif // ENABLE_REMOTING
// Enable Cloud Print if needed. First check the command-line.
bool cloud_print_proxy_enabled =
@@ -224,8 +242,10 @@ void ServiceProcess::Shutdown() {
#if defined(ENABLE_REMOTING)
// During shutdown of remoting host it has some left over operations on
// the UI thread. So we let the teardown to proceed asynchronously
- remoting_host_manager_->Teardown(
- NewRunnableFunction(&QuitMessageLoop, main_message_loop_));
+ if (remoting_host_manager_.get()) {
+ remoting_host_manager_->Teardown(
+ NewRunnableFunction(&QuitMessageLoop, main_message_loop_));
+ }
#else
// Quit the main message loop.
main_message_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask());