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 // MainAppBundlePath returns the Chromium Helper bundle, which in dev builds |
| 402 // sits alongside the Framework bundle, which contains the Libraries we need. |
| 403 media_path = base::mac::MainAppBundlePath(); |
| 404 media_path = media_path.DirName(); |
| 405 media_path = |
| 406 media_path.Append(FILE_PATH_LITERAL("Chromium Framework.framework")); |
| 407 media_path = |
| 408 media_path.Append(FILE_PATH_LITERAL("Libraries")); |
| 409 #else |
| 410 if (!PathService::Get(base::DIR_EXE, &media_path)) { |
| 411 SetException("Failed to find media path"); |
| 412 return false; |
| 413 } |
| 414 #endif |
| 415 if (!media::InitializeMediaLibrary(media_path)) { |
| 416 SetException("Failed to load media library"); |
| 417 return false; |
| 418 } |
| 419 |
390 // Store the supplied user ID and token to the Host configuration. | 420 // Store the supplied user ID and token to the Host configuration. |
391 scoped_refptr<remoting::MutableHostConfig> host_config = | 421 scoped_refptr<remoting::MutableHostConfig> host_config = |
392 new remoting::InMemoryHostConfig; | 422 new remoting::InMemoryHostConfig; |
393 host_config->SetString(remoting::kXmppLoginConfigPath, uid); | 423 host_config->SetString(remoting::kXmppLoginConfigPath, uid); |
394 host_config->SetString(remoting::kXmppAuthTokenConfigPath, auth_token); | 424 host_config->SetString(remoting::kXmppAuthTokenConfigPath, auth_token); |
395 | 425 |
396 // Create an access verifier and fetch the host secret. | 426 // Create an access verifier and fetch the host secret. |
397 scoped_ptr<remoting::SupportAccessVerifier> access_verifier; | 427 scoped_ptr<remoting::SupportAccessVerifier> access_verifier; |
398 access_verifier.reset(new remoting::SupportAccessVerifier); | 428 access_verifier.reset(new remoting::SupportAccessVerifier); |
399 if (!access_verifier->Init()) { | 429 if (!access_verifier->Init()) { |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" | 901 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" |
872 HOST_PLUGIN_NAME ":" | 902 HOST_PLUGIN_NAME ":" |
873 HOST_PLUGIN_DESCRIPTION; | 903 HOST_PLUGIN_DESCRIPTION; |
874 } | 904 } |
875 | 905 |
876 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) { | 906 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) { |
877 return GetValue((NPP)npp, variable, value); | 907 return GetValue((NPP)npp, variable, value); |
878 } | 908 } |
879 | 909 |
880 } // extern "C" | 910 } // extern "C" |
OLD | NEW |