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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/base_paths.h" | |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/file_path.h" | |
14 #include "base/logging.h" | 16 #include "base/logging.h" |
15 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/path_service.h" | |
16 #include "base/rand_util.h" | 19 #include "base/rand_util.h" |
17 #include "base/stringize_macros.h" | 20 #include "base/stringize_macros.h" |
18 #include "base/task.h" | 21 #include "base/task.h" |
19 #include "base/threading/platform_thread.h" | 22 #include "base/threading/platform_thread.h" |
20 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
24 #if defined(OS_MACOSX) | |
25 #include "base/mac/foundation_util.h" | |
26 #endif | |
27 #include "media/base/media.h" | |
21 #include "remoting/host/chromoting_host.h" | 28 #include "remoting/host/chromoting_host.h" |
22 #include "remoting/host/chromoting_host_context.h" | 29 #include "remoting/host/chromoting_host_context.h" |
23 #include "remoting/host/host_config.h" | 30 #include "remoting/host/host_config.h" |
24 #include "remoting/host/host_key_pair.h" | 31 #include "remoting/host/host_key_pair.h" |
25 #include "remoting/host/in_memory_host_config.h" | 32 #include "remoting/host/in_memory_host_config.h" |
26 #include "remoting/host/register_support_host_request.h" | 33 #include "remoting/host/register_support_host_request.h" |
27 #include "remoting/host/support_access_verifier.h" | 34 #include "remoting/host/support_access_verifier.h" |
28 #include "third_party/npapi/bindings/npapi.h" | 35 #include "third_party/npapi/bindings/npapi.h" |
29 #include "third_party/npapi/bindings/npfunctions.h" | 36 #include "third_party/npapi/bindings/npfunctions.h" |
30 #include "third_party/npapi/bindings/npruntime.h" | 37 #include "third_party/npapi/bindings/npruntime.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 SetException("connect: bad uid argument"); | 387 SetException("connect: bad uid argument"); |
381 return false; | 388 return false; |
382 } | 389 } |
383 | 390 |
384 std::string auth_token = StringFromNPVariant(args[1]); | 391 std::string auth_token = StringFromNPVariant(args[1]); |
385 if (auth_token.empty()) { | 392 if (auth_token.empty()) { |
386 SetException("connect: bad auth_token argument"); | 393 SetException("connect: bad auth_token argument"); |
387 return false; | 394 return false; |
388 } | 395 } |
389 | 396 |
397 // TODO(wez): Load the media libraries to get the VP8 encoder. | |
398 // This won't be needed once we link libvpx in statically. | |
399 FilePath media_path; | |
400 #if defined(OS_MACOSX) | |
401 media_path = base::mac::MainAppBundlePath(); | |
dmac
2011/05/23 16:54:50
can you comment why this works? because it wasn't
| |
402 media_path = media_path.DirName(); | |
403 media_path = | |
404 media_path.Append(FILE_PATH_LITERAL("Chromium Framework.framework")); | |
405 media_path = | |
406 media_path.Append(FILE_PATH_LITERAL("Libraries")); | |
407 #else | |
408 if (!PathService::Get(base::DIR_EXE, &media_path)) { | |
409 SetException("Failed to find media path"); | |
410 return false; | |
411 } | |
412 #endif | |
413 if (!media::InitializeMediaLibrary(media_path)) { | |
414 SetException("Failed to load media library"); | |
415 return false; | |
416 } | |
417 | |
390 // Store the supplied user ID and token to the Host configuration. | 418 // Store the supplied user ID and token to the Host configuration. |
391 scoped_refptr<remoting::MutableHostConfig> host_config = | 419 scoped_refptr<remoting::MutableHostConfig> host_config = |
392 new remoting::InMemoryHostConfig; | 420 new remoting::InMemoryHostConfig; |
393 host_config->SetString(remoting::kXmppLoginConfigPath, uid); | 421 host_config->SetString(remoting::kXmppLoginConfigPath, uid); |
394 host_config->SetString(remoting::kXmppAuthTokenConfigPath, auth_token); | 422 host_config->SetString(remoting::kXmppAuthTokenConfigPath, auth_token); |
395 | 423 |
396 // Create an access verifier and fetch the host secret. | 424 // Create an access verifier and fetch the host secret. |
397 scoped_ptr<remoting::SupportAccessVerifier> access_verifier; | 425 scoped_ptr<remoting::SupportAccessVerifier> access_verifier; |
398 access_verifier.reset(new remoting::SupportAccessVerifier); | 426 access_verifier.reset(new remoting::SupportAccessVerifier); |
399 if (!access_verifier->Init()) { | 427 if (!access_verifier->Init()) { |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" | 899 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" |
872 HOST_PLUGIN_NAME ":" | 900 HOST_PLUGIN_NAME ":" |
873 HOST_PLUGIN_DESCRIPTION; | 901 HOST_PLUGIN_DESCRIPTION; |
874 } | 902 } |
875 | 903 |
876 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) { | 904 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) { |
877 return GetValue((NPP)npp, variable, value); | 905 return GetValue((NPP)npp, variable, value); |
878 } | 906 } |
879 | 907 |
880 } // extern "C" | 908 } // extern "C" |
OLD | NEW |