summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util
diff options
context:
space:
mode:
authorsatish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 08:32:02 +0000
committersatish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 08:32:02 +0000
commit562d634ceb3ec6ff5b9891456d6ea10e1a481213 (patch)
treedd64a86650f86be596239ed9792ca9f0f6f95312 /chrome/installer/util
parentdd17f6bd436e1acd886dbf4f3856b00af64708de (diff)
downloadchromium_src-562d634ceb3ec6ff5b9891456d6ea10e1a481213.zip
chromium_src-562d634ceb3ec6ff5b9891456d6ea10e1a481213.tar.gz
chromium_src-562d634ceb3ec6ff5b9891456d6ea10e1a481213.tar.bz2
On windows, send audio hardware info with speech input requests if user consented.
This may help identify quality issues. BUG=61677 TEST=none Review URL: http://codereview.chromium.org/4724001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util')
-rw-r--r--chrome/installer/util/wmi.cc40
-rw-r--r--chrome/installer/util/wmi.h9
2 files changed, 49 insertions, 0 deletions
diff --git a/chrome/installer/util/wmi.cc b/chrome/installer/util/wmi.cc
index fca2076..e873277 100644
--- a/chrome/installer/util/wmi.cc
+++ b/chrome/installer/util/wmi.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/win/scoped_bstr.h"
#include "base/win/scoped_comptr.h"
+#include "base/win/scoped_variant.h"
#pragma comment(lib, "wbemuuid.lib")
@@ -150,4 +151,43 @@ bool WMIProcess::Launch(const std::wstring& command_line, int* process_id) {
return true;
}
+string16 WMIComputerSystem::GetModel() {
+ base::win::ScopedComPtr<IWbemServices> services;
+ if (!WMI::CreateLocalConnection(true, services.Receive()))
+ return string16();
+
+ base::win::ScopedBstr query_language(L"WQL");
+ base::win::ScopedBstr query(L"SELECT * FROM Win32_ComputerSystem");
+ base::win::ScopedComPtr<IEnumWbemClassObject> enumerator;
+ HRESULT hr = services->ExecQuery(
+ query_language, query,
+ WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL,
+ enumerator.Receive());
+ if (FAILED(hr) || !enumerator)
+ return string16();
+
+ base::win::ScopedComPtr<IWbemClassObject> class_object;
+ ULONG items_returned = 0;
+ hr = enumerator->Next(WBEM_INFINITE, 1, class_object.Receive(),
+ &items_returned);
+ if (!items_returned)
+ return string16();
+
+ base::win::ScopedVariant manufacturer;
+ class_object->Get(L"Manufacturer", 0, manufacturer.Receive(), 0, 0);
+ base::win::ScopedVariant model;
+ class_object->Get(L"Model", 0, model.Receive(), 0, 0);
+
+ string16 model_string;
+ if (manufacturer.type() == VT_BSTR) {
+ model_string = V_BSTR(&manufacturer);
+ if (model.type() == VT_BSTR)
+ model_string += L" ";
+ }
+ if (model.type() == VT_BSTR)
+ model_string += V_BSTR(&model);
+
+ return model_string;
+}
+
} // namespace installer
diff --git a/chrome/installer/util/wmi.h b/chrome/installer/util/wmi.h
index 5d0a1a9..03106dc 100644
--- a/chrome/installer/util/wmi.h
+++ b/chrome/installer/util/wmi.h
@@ -21,6 +21,7 @@
#define CHROME_INSTALLER_UTIL_WMI_H_
#pragma once
+#include "base/string16.h"
#include <string>
#include <wbemidl.h>
@@ -73,6 +74,14 @@ class WMIProcess {
static bool Launch(const std::wstring& command_line, int* process_id);
};
+// This class contains functionality of the WMI class 'Win32_ComputerSystem'
+// more info: http://msdn.microsoft.com/en-us/library/aa394102(VS.85).aspx
+class WMIComputerSystem {
+ public:
+ // Returns a human readable string for the model/make of this computer.
+ static string16 GetModel();
+};
+
} // namespace installer
#endif // CHROME_INSTALLER_UTIL_WMI_H_