diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc index 892c26141aa9..f94216461769 100644 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc +++ b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc @@ -4,6 +4,8 @@ #include "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h" +#include + #if defined(OS_WIN) #include #endif @@ -12,12 +14,14 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/memory/ref_counted.h" +#include "base/strings/string_number_conversions.h" #include "build/build_config.h" #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_frame_host.h" #include "content/public/common/pepper_plugin_info.h" +#include "net/base/net_util.h" #include "ppapi/c/pp_errors.h" #include "ppapi/host/dispatch_host_message.h" #include "ppapi/host/host_message_context.h" @@ -38,7 +42,30 @@ using content::BrowserPpapiHost; namespace chrome { namespace { + const char kVoucherFilename[] = "plugin.vch"; + +#if defined(OS_WIN) +bool GetSystemVolumeSerialNumber(std::string* number) { + // Find the system root path (e.g: C:\). + wchar_t system_path[MAX_PATH + 1]; + if (!GetSystemDirectoryW(system_path, MAX_PATH)) + return false; + + wchar_t* first_slash = wcspbrk(system_path, L"\\/"); + if (first_slash != NULL) + *(first_slash + 1) = 0; + + DWORD number_local = 0; + if (!GetVolumeInformationW(system_path, NULL, 0, &number_local, NULL, NULL, + NULL, 0)) + return false; + + *number = base::IntToString(std::abs(static_cast(number_local))); + return true; +} +#endif + } #if defined(OS_WIN) @@ -149,7 +176,15 @@ int32_t PepperFlashDRMHost::OnResourceMessageReceived( int32_t PepperFlashDRMHost::OnHostMsgGetDeviceID( ppapi::host::HostMessageContext* context) { - context->reply_msg = PpapiPluginMsg_FlashDRM_GetDeviceIDReply(""); + static std::string id; +#if defined(OS_WIN) + if (id.empty() && !GetSystemVolumeSerialNumber(&id)) + id = net::GetHostName(); +#else + if (id.empty()) + id = net::GetHostName(); +#endif + context->reply_msg = PpapiPluginMsg_FlashDRM_GetDeviceIDReply(id); return PP_OK; }