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

Unified Diff: chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc

Issue 2932703006: Chrome Cleaner: Remove indirect base::FilePath mojo dependency. (Closed)
Patch Set: Address review comments, make tests pass Created 3 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
Index: chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc b/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc
index 826657780c9f28dcd187bb542f3c39cc23389da6..313286afd034e7bf0a2bf9561408d9cf73cbb0a7 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc
@@ -14,6 +14,14 @@
namespace safe_browsing {
+namespace {
+
+base::FilePath UInt16VectorToFilePath(const std::vector<uint16_t>& string) {
+ return base::FilePath(base::string16(string.begin(), string.end()));
Fabio Tirelo 2017/06/12 18:20:46 It may be worth static asserting that size_of(u
proberge 2017/06/12 19:02:53 Done.
+}
+
+} // namespace
+
using chrome_cleaner::mojom::ChromePrompt;
using chrome_cleaner::mojom::ChromePromptRequest;
using chrome_cleaner::mojom::PromptAcceptance;
@@ -34,12 +42,17 @@ ChromePromptImpl::~ChromePromptImpl() {
}
void ChromePromptImpl::PromptUser(
- const std::vector<base::FilePath>& files_to_delete,
+ std::vector<chrome_cleaner::mojom::FilePathPtr> files_to_delete,
ChromePrompt::PromptUserCallback callback) {
if (on_prompt_user_) {
+ std::set<base::FilePath> file_paths;
+ for (const chrome_cleaner::mojom::FilePathPtr& file_path_ptr :
+ files_to_delete) {
+ file_paths.insert(UInt16VectorToFilePath(file_path_ptr.get()->value));
+ }
+
std::move(on_prompt_user_)
- .Run(base::MakeUnique<std::set<base::FilePath>>(files_to_delete.begin(),
- files_to_delete.end()),
+ .Run(base::MakeUnique<std::set<base::FilePath>>(std::move(file_paths)),
std::move(callback));
}
}

Powered by Google App Engine
This is Rietveld 408576698