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

Unified Diff: chrome/browser/webshare/share_service_impl.cc

Issue 2703333002: Web Share: Refactor Mojo interface to now return an enum error. (Closed)
Patch Set: Fix assignment statement. #oops Created 3 years, 10 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/webshare/share_service_impl.cc
diff --git a/chrome/browser/webshare/share_service_impl.cc b/chrome/browser/webshare/share_service_impl.cc
index 9ce3e713b52b05175908b3343ff9d3f9ff17e469..4aca48813cb7b9e3b798b387f6a54bfa1d24fcf9 100644
--- a/chrome/browser/webshare/share_service_impl.cc
+++ b/chrome/browser/webshare/share_service_impl.cc
@@ -199,7 +199,7 @@ void ShareServiceImpl::OnPickerClosed(
const ShareCallback& callback,
base::Optional<std::string> result) {
if (!result.has_value()) {
- callback.Run(base::Optional<std::string>("Share was cancelled"));
+ callback.Run(blink::mojom::ShareError::CANCELED);
return;
}
@@ -209,8 +209,10 @@ void ShareServiceImpl::OnPickerClosed(
std::string url_template_filled;
if (!ReplacePlaceholders(url_template, title, text, share_url,
&url_template_filled)) {
- callback.Run(base::Optional<std::string>(
- "Error: unable to replace placeholders in url template"));
+ // TODO(mgiuca): This error should not be possible at share time, because
+ // targets with invalid templates should not be chooseable. Fix
+ // https://crbug.com/694380 and replace this with a DCHECK.
+ callback.Run(blink::mojom::ShareError::INTERNAL_ERROR);
return;
}
@@ -229,5 +231,5 @@ void ShareServiceImpl::OnPickerClosed(
DCHECK(target.is_valid());
OpenTargetURL(target);
- callback.Run(base::nullopt);
+ callback.Run(blink::mojom::ShareError::OK);
}

Powered by Google App Engine
This is Rietveld 408576698