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

Unified Diff: components/update_client/utils.cc

Issue 1823273002: Send the value of google_brand::GetBrand in component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor unit test improvement. Created 4 years, 9 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 | « components/update_client/utils.h ('k') | components/update_client/utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/utils.cc
diff --git a/components/update_client/utils.cc b/components/update_client/utils.cc
index a6ec277e6e9708eee70cc64c8b8afed32620be43..a76e07329fac74a7c32c71d97fdb4edfd8fe4e9a 100644
--- a/components/update_client/utils.cc
+++ b/components/update_client/utils.cc
@@ -6,6 +6,8 @@
#include <stddef.h>
#include <stdint.h>
+
+#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
@@ -226,4 +228,14 @@ bool VerifyFileHash256(const base::FilePath& filepath,
return memcmp(actual_hash, &expected_hash[0], sizeof(actual_hash)) == 0;
}
+bool IsValidBrand(const std::string& brand) {
+ const size_t kMaxBrandSize = 4;
+ if (brand.size() > kMaxBrandSize)
+ return false;
+
+ return std::find_if_not(brand.begin(), brand.end(), [](char ch) {
+ return base::IsAsciiAlpha(ch);
+ }) == brand.end();
+}
+
} // namespace update_client
« no previous file with comments | « components/update_client/utils.h ('k') | components/update_client/utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698