Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: remoting/host/host_plugin.cc

Issue 7008003: Wire in OAuth2 support into non-sandboxed connections in libjingle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright + rebase Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/host_config.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base_paths.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/rand_util.h" 19 #include "base/rand_util.h"
20 #include "base/stringize_macros.h" 20 #include "base/stringize_macros.h"
21 #include "base/task.h" 21 #include "base/task.h"
22 #include "base/threading/platform_thread.h" 22 #include "base/threading/platform_thread.h"
23 #include "base/threading/thread.h" 23 #include "base/threading/thread.h"
24 #if defined(OS_MACOSX) 24 #if defined(OS_MACOSX)
25 #include "base/mac/foundation_util.h" 25 #include "base/mac/foundation_util.h"
26 #endif 26 #endif
27 #include "media/base/media.h" 27 #include "media/base/media.h"
28 #include "remoting/base/auth_token_util.h"
28 #include "remoting/host/chromoting_host.h" 29 #include "remoting/host/chromoting_host.h"
29 #include "remoting/host/chromoting_host_context.h" 30 #include "remoting/host/chromoting_host_context.h"
30 #include "remoting/host/host_config.h" 31 #include "remoting/host/host_config.h"
31 #include "remoting/host/host_key_pair.h" 32 #include "remoting/host/host_key_pair.h"
32 #include "remoting/host/in_memory_host_config.h" 33 #include "remoting/host/in_memory_host_config.h"
33 #include "remoting/host/register_support_host_request.h" 34 #include "remoting/host/register_support_host_request.h"
34 #include "remoting/host/support_access_verifier.h" 35 #include "remoting/host/support_access_verifier.h"
35 #include "third_party/npapi/bindings/npapi.h" 36 #include "third_party/npapi/bindings/npapi.h"
36 #include "third_party/npapi/bindings/npfunctions.h" 37 #include "third_party/npapi/bindings/npfunctions.h"
37 #include "third_party/npapi/bindings/npruntime.h" 38 #include "third_party/npapi/bindings/npruntime.h"
(...skipping 13 matching lines...) Expand all
51 DISCONNECTED, 52 DISCONNECTED,
52 REQUESTED_ACCESS_CODE, 53 REQUESTED_ACCESS_CODE,
53 RECEIVED_ACCESS_CODE, 54 RECEIVED_ACCESS_CODE,
54 CONNECTED, 55 CONNECTED,
55 AFFIRMING_CONNECTION, 56 AFFIRMING_CONNECTION,
56 ERROR, 57 ERROR,
57 } 58 }
58 59
59 attribute Function void onStateChanged(); 60 attribute Function void onStateChanged();
60 61
61 void connect(string uid, string auth_token); 62 // The |auth_service_with_token| parametershould be in the format
63 // "auth_service:auth_token". An example would be "oauth2:1/2a3912vd".
64 void connect(string uid, string auth_service_with_token);
62 void disconnect(); 65 void disconnect();
63 */ 66 */
64 67
65 namespace { 68 namespace {
66 69
67 // Global netscape functions initialized in NP_Initialize. 70 // Global netscape functions initialized in NP_Initialize.
68 NPNetscapeFuncs* g_npnetscape_funcs = NULL; 71 NPNetscapeFuncs* g_npnetscape_funcs = NULL;
69 72
70 // The name and description are returned by GetValue, but are also 73 // The name and description are returned by GetValue, but are also
71 // combined with the MIME type to satisfy GetMIMEDescription, so we 74 // combined with the MIME type to satisfy GetMIMEDescription, so we
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 SetException("connect: bad number of arguments"); 384 SetException("connect: bad number of arguments");
382 return false; 385 return false;
383 } 386 }
384 387
385 std::string uid = StringFromNPVariant(args[0]); 388 std::string uid = StringFromNPVariant(args[0]);
386 if (uid.empty()) { 389 if (uid.empty()) {
387 SetException("connect: bad uid argument"); 390 SetException("connect: bad uid argument");
388 return false; 391 return false;
389 } 392 }
390 393
391 std::string auth_token = StringFromNPVariant(args[1]); 394 std::string auth_service_with_token = StringFromNPVariant(args[1]);
395 std::string auth_token;
396 std::string auth_service;
397 remoting::ParseAuthTokenWithService(auth_service_with_token, &auth_token,
398 &auth_service);
392 if (auth_token.empty()) { 399 if (auth_token.empty()) {
393 SetException("connect: bad auth_token argument"); 400 SetException("connect: auth_service_with_token argument has empty token");
394 return false; 401 return false;
395 } 402 }
396 403
397 // TODO(wez): Load the media libraries to get the VP8 encoder. 404 // TODO(wez): Load the media libraries to get the VP8 encoder.
398 // This won't be needed once we link libvpx in statically. 405 // This won't be needed once we link libvpx in statically.
399 FilePath media_path; 406 FilePath media_path;
400 #if defined(OS_MACOSX) 407 #if defined(OS_MACOSX)
401 // MainAppBundlePath returns the Chromium Helper bundle, which in dev builds 408 // MainAppBundlePath returns the Chromium Helper bundle, which in dev builds
402 // sits alongside the Framework bundle, which contains the Libraries we need. 409 // sits alongside the Framework bundle, which contains the Libraries we need.
403 media_path = base::mac::MainAppBundlePath(); 410 media_path = base::mac::MainAppBundlePath();
(...skipping 11 matching lines...) Expand all
415 if (!media::InitializeMediaLibrary(media_path)) { 422 if (!media::InitializeMediaLibrary(media_path)) {
416 SetException("Failed to load media library"); 423 SetException("Failed to load media library");
417 return false; 424 return false;
418 } 425 }
419 426
420 // Store the supplied user ID and token to the Host configuration. 427 // Store the supplied user ID and token to the Host configuration.
421 scoped_refptr<remoting::MutableHostConfig> host_config = 428 scoped_refptr<remoting::MutableHostConfig> host_config =
422 new remoting::InMemoryHostConfig; 429 new remoting::InMemoryHostConfig;
423 host_config->SetString(remoting::kXmppLoginConfigPath, uid); 430 host_config->SetString(remoting::kXmppLoginConfigPath, uid);
424 host_config->SetString(remoting::kXmppAuthTokenConfigPath, auth_token); 431 host_config->SetString(remoting::kXmppAuthTokenConfigPath, auth_token);
432 host_config->SetString(remoting::kXmppAuthServiceConfigPath, auth_service);
425 433
426 // Create an access verifier and fetch the host secret. 434 // Create an access verifier and fetch the host secret.
427 scoped_ptr<remoting::SupportAccessVerifier> access_verifier; 435 scoped_ptr<remoting::SupportAccessVerifier> access_verifier;
428 access_verifier.reset(new remoting::SupportAccessVerifier); 436 access_verifier.reset(new remoting::SupportAccessVerifier);
429 if (!access_verifier->Init()) { 437 if (!access_verifier->Init()) {
430 SetException("connect: SupportAccessVerifier::Init failed"); 438 SetException("connect: SupportAccessVerifier::Init failed");
431 return false; 439 return false;
432 } 440 }
433 441
434 // Generate a key pair for the Host to use. 442 // Generate a key pair for the Host to use.
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" 947 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":"
940 HOST_PLUGIN_NAME ":" 948 HOST_PLUGIN_NAME ":"
941 HOST_PLUGIN_DESCRIPTION; 949 HOST_PLUGIN_DESCRIPTION;
942 } 950 }
943 951
944 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) { 952 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) {
945 return GetValue((NPP)npp, variable, value); 953 return GetValue((NPP)npp, variable, value);
946 } 954 }
947 955
948 } // extern "C" 956 } // extern "C"
OLDNEW
« no previous file with comments | « remoting/host/host_config.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698