diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-12-11 21:33:03 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-12-13 12:34:07 +0100 |
commit | f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch) | |
tree | 0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/ppapi/cpp/private | |
parent | 5362912cdb5eea702b68ebe23702468d17c3017a (diff) | |
download | qtwebengine-chromium-f2a33ff9cbc6d19943f1c7fbddd1f23d23975577.tar.gz |
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/ppapi/cpp/private')
-rw-r--r-- | chromium/ppapi/cpp/private/content_decryptor_private.cc | 38 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/content_decryptor_private.h | 8 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/network_list_private.cc | 110 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/network_list_private.h | 58 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/network_monitor_private.cc | 35 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/network_monitor_private.h | 28 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/pdf.cc | 10 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/pdf.h | 2 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/platform_verification.cc | 66 | ||||
-rw-r--r-- | chromium/ppapi/cpp/private/platform_verification.h | 33 |
10 files changed, 131 insertions, 257 deletions
diff --git a/chromium/ppapi/cpp/private/content_decryptor_private.cc b/chromium/ppapi/cpp/private/content_decryptor_private.cc index 48690946128..23417c3e155 100644 --- a/chromium/ppapi/cpp/private/content_decryptor_private.cc +++ b/chromium/ppapi/cpp/private/content_decryptor_private.cc @@ -23,10 +23,9 @@ namespace { static const char kPPPContentDecryptorInterface[] = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE; -void GenerateKeyRequest(PP_Instance instance, - PP_Var key_system_arg, - PP_Var type_arg, - PP_Var init_data_arg) { +void Initialize(PP_Instance instance, + PP_Var key_system_arg, + PP_Bool can_challenge_platform) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); if (!object) @@ -36,6 +35,19 @@ void GenerateKeyRequest(PP_Instance instance, if (!key_system_var.is_string()) return; + static_cast<ContentDecryptor_Private*>(object)->Initialize( + key_system_var.AsString(), + PP_ToBool(can_challenge_platform)); +} + +void GenerateKeyRequest(PP_Instance instance, + PP_Var type_arg, + PP_Var init_data_arg) { + void* object = + Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); + if (!object) + return; + pp::Var type_var(pp::PASS_REF, type_arg); if (!type_var.is_string()) return; @@ -46,7 +58,6 @@ void GenerateKeyRequest(PP_Instance instance, pp::VarArrayBuffer init_data_array_buffer(init_data_var); static_cast<ContentDecryptor_Private*>(object)->GenerateKeyRequest( - key_system_var.AsString(), type_var.AsString(), init_data_array_buffer); } @@ -184,6 +195,7 @@ void DecryptAndDecode(PP_Instance instance, } const PPP_ContentDecryptor_Private ppp_content_decryptor = { + &Initialize, &GenerateKeyRequest, &AddKey, &CancelKeyRequest, @@ -214,22 +226,6 @@ ContentDecryptor_Private::~ContentDecryptor_Private() { this); } -void ContentDecryptor_Private::NeedKey(const std::string& key_system, - const std::string& session_id, - pp::VarArrayBuffer init_data) { - // session_id can be empty here. - if (has_interface<PPB_ContentDecryptor_Private>()) { - pp::Var key_system_var(key_system); - pp::Var session_id_var(session_id); - - get_interface<PPB_ContentDecryptor_Private>()->NeedKey( - associated_instance_.pp_instance(), - key_system_var.pp_var(), - session_id_var.pp_var(), - init_data.pp_var()); - } -} - void ContentDecryptor_Private::KeyAdded(const std::string& key_system, const std::string& session_id) { if (has_interface<PPB_ContentDecryptor_Private>()) { diff --git a/chromium/ppapi/cpp/private/content_decryptor_private.h b/chromium/ppapi/cpp/private/content_decryptor_private.h index 477c6de5c25..a43a74cfb83 100644 --- a/chromium/ppapi/cpp/private/content_decryptor_private.h +++ b/chromium/ppapi/cpp/private/content_decryptor_private.h @@ -31,8 +31,9 @@ class ContentDecryptor_Private { // TODO(tomfinegan): This could be optimized to pass pp::Var instead of // strings. The change would allow the CDM wrapper to reuse vars when // replying to the browser. - virtual void GenerateKeyRequest(const std::string& key_system, - const std::string& type, + virtual void Initialize(const std::string& key_system, + bool can_challenge_platform) = 0; + virtual void GenerateKeyRequest(const std::string& type, pp::VarArrayBuffer init_data) = 0; virtual void AddKey(const std::string& session_id, pp::VarArrayBuffer key, @@ -58,9 +59,6 @@ class ContentDecryptor_Private { // PPB_ContentDecryptor_Private methods for passing data from the decryptor // to the browser. - void NeedKey(const std::string& key_system, - const std::string& session_id, - pp::VarArrayBuffer init_data); void KeyAdded(const std::string& key_system, const std::string& session_id); void KeyMessage(const std::string& key_system, diff --git a/chromium/ppapi/cpp/private/network_list_private.cc b/chromium/ppapi/cpp/private/network_list_private.cc deleted file mode 100644 index 1297aa3a09c..00000000000 --- a/chromium/ppapi/cpp/private/network_list_private.cc +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/private/network_list_private.h" - -#include "ppapi/cpp/module_impl.h" -#include "ppapi/cpp/var.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_NetworkList_Private>() { - return PPB_NETWORKLIST_PRIVATE_INTERFACE; -} - -} // namespace - -NetworkListPrivate::NetworkListPrivate() { -} - -NetworkListPrivate::NetworkListPrivate(PassRef, PP_Resource resource) - : Resource(PASS_REF, resource) { -} - -// static -bool NetworkListPrivate::IsAvailable() { - return has_interface<PPB_NetworkList_Private>(); -} - -uint32_t NetworkListPrivate::GetCount() const { - if (!has_interface<PPB_NetworkList_Private>()) - return 0; - return get_interface<PPB_NetworkList_Private>()->GetCount(pp_resource()); -} - -std::string NetworkListPrivate::GetName(uint32_t index) const { - if (!has_interface<PPB_NetworkList_Private>()) - return std::string(); - Var result(PASS_REF, - get_interface<PPB_NetworkList_Private>()->GetName( - pp_resource(), index)); - return result.is_string() ? result.AsString() : std::string(); -} - -PP_NetworkListType_Private NetworkListPrivate::GetType(uint32_t index) const { - if (!has_interface<PPB_NetworkList_Private>()) - return PP_NETWORKLIST_ETHERNET; - return get_interface<PPB_NetworkList_Private>()->GetType( - pp_resource(), index); -} - -PP_NetworkListState_Private NetworkListPrivate::GetState(uint32_t index) const { - if (!has_interface<PPB_NetworkList_Private>()) - return PP_NETWORKLIST_DOWN; - return get_interface<PPB_NetworkList_Private>()->GetState( - pp_resource(), index); -} - -void NetworkListPrivate::GetIpAddresses( - uint32_t index, - std::vector<PP_NetAddress_Private>* addresses) const { - if (!has_interface<PPB_NetworkList_Private>()) - return; - - // Most network interfaces don't have more than 3 network - // interfaces. - addresses->resize(3); - - int32_t result = get_interface<PPB_NetworkList_Private>()->GetIpAddresses( - pp_resource(), index, &addresses->front(), addresses->size()); - - if (result < 0) { - addresses->resize(0); - return; - } - - if (result <= static_cast<int32_t>(addresses->size())) { - addresses->resize(result); - return; - } - - addresses->resize(result); - result = get_interface<PPB_NetworkList_Private>()->GetIpAddresses( - pp_resource(), index, &addresses->front(), addresses->size()); - if (result < 0) { - addresses->resize(0); - } else if (result < static_cast<int32_t>(addresses->size())) { - addresses->resize(result); - } -} - -std::string NetworkListPrivate::GetDisplayName(uint32_t index) const { - if (!has_interface<PPB_NetworkList_Private>()) - return std::string(); - Var result(PASS_REF, - get_interface<PPB_NetworkList_Private>()->GetDisplayName( - pp_resource(), index)); - return result.is_string() ? result.AsString() : std::string(); -} - -uint32_t NetworkListPrivate::GetMTU(uint32_t index) const { - if (!has_interface<PPB_NetworkList_Private>()) - return 0; - return get_interface<PPB_NetworkList_Private>()->GetMTU( - pp_resource(), index); -} - -} // namespace pp diff --git a/chromium/ppapi/cpp/private/network_list_private.h b/chromium/ppapi/cpp/private/network_list_private.h deleted file mode 100644 index 31cd9b598b8..00000000000 --- a/chromium/ppapi/cpp/private/network_list_private.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_CPP_PRIVATE_NETWORK_LIST_PRIVATE_H_ -#define PPAPI_CPP_PRIVATE_NETWORK_LIST_PRIVATE_H_ - -#include <string> -#include <vector> - -#include "ppapi/c/private/ppb_network_list_private.h" -#include "ppapi/cpp/pass_ref.h" -#include "ppapi/cpp/resource.h" - -namespace pp { - -class NetworkListPrivate : public Resource { - public: - NetworkListPrivate(); - NetworkListPrivate(PassRef, PP_Resource resource); - - /// Returns true if the required interface is available. - static bool IsAvailable(); - - /// @return Returns the number of available network interfaces or 0 - /// if the list has never been updated. - uint32_t GetCount() const; - - /// @return Returns the name for the network interface with the - /// specified <code>index</code>. - std::string GetName(uint32_t index) const; - - /// @return Returns the type of the network interface with the - /// specified <code>index</code>. - PP_NetworkListType_Private GetType(uint32_t index) const; - - /// @return Returns the current state of the network interface with - /// the specified <code>index</code>. - PP_NetworkListState_Private GetState(uint32_t index) const; - - /// Gets the list of IP addresses for the network interface with the - /// specified <code>index</code> and stores them in - /// <code>addresses</code>. - void GetIpAddresses(uint32_t index, - std::vector<PP_NetAddress_Private>* addresses) const; - - /// @return Returns the display name for the network interface with - /// the specified <code>index</code>. - std::string GetDisplayName(uint32_t index) const; - - /// @return Returns the MTU for the network interface with the - /// specified <code>index</code>. - uint32_t GetMTU(uint32_t index) const; -}; - -} // namespace pp - -#endif // PPAPI_CPP_PRIVATE_NETWORK_LIST_PRIVATE_H_ diff --git a/chromium/ppapi/cpp/private/network_monitor_private.cc b/chromium/ppapi/cpp/private/network_monitor_private.cc deleted file mode 100644 index 2f931ea4288..00000000000 --- a/chromium/ppapi/cpp/private/network_monitor_private.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/private/network_monitor_private.h" - -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_NetworkMonitor_Private>() { - return PPB_NETWORKMONITOR_PRIVATE_INTERFACE; -} - -} // namespace - -NetworkMonitorPrivate::NetworkMonitorPrivate( - const InstanceHandle& instance, - PPB_NetworkMonitor_Callback callback, - void* user_data) { - if (has_interface<PPB_NetworkMonitor_Private>()) { - PassRefFromConstructor(get_interface<PPB_NetworkMonitor_Private>()->Create( - instance.pp_instance(), callback, user_data)); - } -} - -// static -bool NetworkMonitorPrivate::IsAvailable() { - return has_interface<PPB_NetworkMonitor_Private>(); -} - -} // namespace pp diff --git a/chromium/ppapi/cpp/private/network_monitor_private.h b/chromium/ppapi/cpp/private/network_monitor_private.h deleted file mode 100644 index 693bbcdc7fb..00000000000 --- a/chromium/ppapi/cpp/private/network_monitor_private.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_CPP_PRIVATE_NETWORK_MONITOR_PRIVATE_H_ -#define PPAPI_CPP_PRIVATE_NETWORK_MONITOR_PRIVATE_H_ - -#include "ppapi/c/private/ppb_network_monitor_private.h" -#include "ppapi/cpp/resource.h" -#include "ppapi/cpp/instance_handle.h" - -namespace pp { - -class Instance; - -class NetworkMonitorPrivate : public Resource { - public: - NetworkMonitorPrivate(const InstanceHandle& instance, - PPB_NetworkMonitor_Callback callback, - void* user_data); - - // Returns true if the required interface is available. - static bool IsAvailable(); -}; - -} // namespace pp - -#endif // PPAPI_CPP_PRIVATE_NETWORK_MONITOR_PRIVATE_H_ diff --git a/chromium/ppapi/cpp/private/pdf.cc b/chromium/ppapi/cpp/private/pdf.cc index 753613c18a3..9d6bd898251 100644 --- a/chromium/ppapi/cpp/private/pdf.cc +++ b/chromium/ppapi/cpp/private/pdf.cc @@ -184,4 +184,14 @@ ImageData PDF::GetResourceImageForScale(const InstanceHandle& instance, return ImageData(); } +Var PDF::ModalPromptForPassword(const InstanceHandle& instance, + Var message) { + if (has_interface<PPB_PDF>()) { + return Var(PASS_REF, + get_interface<PPB_PDF>()->ModalPromptForPassword( + instance.pp_instance(), + message.pp_var())); + } + return Var(); +} } // namespace pp diff --git a/chromium/ppapi/cpp/private/pdf.h b/chromium/ppapi/cpp/private/pdf.h index 893f9e3f279..1e89dd0c7ed 100644 --- a/chromium/ppapi/cpp/private/pdf.h +++ b/chromium/ppapi/cpp/private/pdf.h @@ -62,6 +62,8 @@ class PDF { static ImageData GetResourceImageForScale(const InstanceHandle& instance, PP_ResourceImage image_id, float scale); + static Var ModalPromptForPassword(const InstanceHandle& instance, + Var message); }; } // namespace pp diff --git a/chromium/ppapi/cpp/private/platform_verification.cc b/chromium/ppapi/cpp/private/platform_verification.cc new file mode 100644 index 00000000000..f9085700696 --- /dev/null +++ b/chromium/ppapi/cpp/private/platform_verification.cc @@ -0,0 +1,66 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/private/platform_verification.h" + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/private/ppb_platform_verification_private.h" +#include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/var.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_PlatformVerification_Private_0_1>() { + return PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_1; +} + +inline bool HasInterface() { + return has_interface<PPB_PlatformVerification_Private_0_1>(); +} + +inline const PPB_PlatformVerification_Private_0_1* GetInterface() { + return get_interface<PPB_PlatformVerification_Private_0_1>(); +} + +} // namespace + +PlatformVerification::PlatformVerification(const InstanceHandle& instance) { + if (HasInterface()) + PassRefFromConstructor(GetInterface()->Create(instance.pp_instance())); +} + +PlatformVerification::~PlatformVerification() {} + +int32_t PlatformVerification::CanChallengePlatform( + const CompletionCallbackWithOutput<bool>& callback) { + if (!HasInterface()) + return callback.MayForce(PP_ERROR_NOINTERFACE); + + return GetInterface()->CanChallengePlatform( + pp_resource(), callback.output(), callback.pp_completion_callback()); +} + +int32_t PlatformVerification::ChallengePlatform( + const Var& service_id, + const Var& challenge, + Var* signed_data, + Var* signed_data_signature, + Var* platform_key_certificate, + const CompletionCallback& callback) { + if (!HasInterface()) + return callback.MayForce(PP_ERROR_NOINTERFACE); + + return GetInterface()->ChallengePlatform( + pp_resource(), service_id.pp_var(), challenge.pp_var(), + const_cast<PP_Var*>(&signed_data->pp_var()), + const_cast<PP_Var*>(&signed_data_signature->pp_var()), + const_cast<PP_Var*>(&platform_key_certificate->pp_var()), + callback.pp_completion_callback()); +} + +} // namespace pp diff --git a/chromium/ppapi/cpp/private/platform_verification.h b/chromium/ppapi/cpp/private/platform_verification.h new file mode 100644 index 00000000000..7f0f8a197ff --- /dev/null +++ b/chromium/ppapi/cpp/private/platform_verification.h @@ -0,0 +1,33 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_CPP_PRIVATE_PLATFORM_VERIFICATION_H_ +#define PPAPI_CPP_PRIVATE_PLATFORM_VERIFICATION_H_ + +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/resource.h" + +namespace pp { + +class InstanceHandle; +class Var; + +class PlatformVerification : public Resource { + public: + explicit PlatformVerification(const InstanceHandle& instance); + virtual ~PlatformVerification(); + + int32_t CanChallengePlatform( + const CompletionCallbackWithOutput<bool>& callback); + int32_t ChallengePlatform(const Var& service_id, + const Var& challenge, + Var* signed_data, + Var* signed_data_signature, + Var* platform_key_certificate, + const CompletionCallback& callback); +}; + +} // namespace pp + +#endif // PPAPI_CPP_PRIVATE_PLATFORM_VERIFICATION_H_ |