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

Unified Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 18055008: Expose "Chrome" as accessible product name. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add dcheck Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/chrome_version_info.cc ('k') | content/public/common/content_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility_win.cc
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc
index a079db5ccba8b662bd8133b299e64dfebd680e44..792adc4440d08fa643c148f700ed9353ac1d041c 100644
--- a/content/browser/accessibility/browser_accessibility_win.cc
+++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -8,6 +8,7 @@
#include <UIAutomationCoreApi.h>
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/enum_variant.h"
@@ -867,8 +868,14 @@ STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) {
if (!app_name)
return E_INVALIDARG;
- std::string product_name = GetContentClient()->GetProduct();
- *app_name = SysAllocString(UTF8ToUTF16(product_name).c_str());
+ // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out
+ // the part before the "/".
+ std::vector<std::string> product_components;
+ base::SplitString(GetContentClient()->GetProduct(), '/', &product_components);
+ DCHECK_EQ(2U, product_components.size());
+ if (product_components.size() != 2)
+ return E_FAIL;
+ *app_name = SysAllocString(UTF8ToUTF16(product_components[0]).c_str());
DCHECK(*app_name);
return *app_name ? S_OK : E_FAIL;
}
@@ -880,8 +887,14 @@ STDMETHODIMP BrowserAccessibilityWin::get_appVersion(BSTR* app_version) {
if (!app_version)
return E_INVALIDARG;
- std::string user_agent = GetContentClient()->GetUserAgent();
- *app_version = SysAllocString(UTF8ToUTF16(user_agent).c_str());
+ // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out
+ // the part after the "/".
+ std::vector<std::string> product_components;
+ base::SplitString(GetContentClient()->GetProduct(), '/', &product_components);
+ DCHECK_EQ(2U, product_components.size());
+ if (product_components.size() != 2)
+ return E_FAIL;
+ *app_version = SysAllocString(UTF8ToUTF16(product_components[1]).c_str());
DCHECK(*app_version);
return *app_version ? S_OK : E_FAIL;
}
« no previous file with comments | « chrome/common/chrome_version_info.cc ('k') | content/public/common/content_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698