Re-design Unsubscribe and getPermissionStatus mojo interfaces.

We use the ErrorType as flag to indicate the calling of unsubscribe and
getPermissionStatus are success or error. So the |is_success| flag is redundant
and can be removed.

The ErrorType::UNKNOWN is changed into ErrorType::NONE to have a better meaning.

BUG=693366

Review-Url: https://codereview.chromium.org/2715903002
Cr-Commit-Position: refs/heads/master@{#453507}
diff --git a/content/common/push_messaging.mojom b/content/common/push_messaging.mojom
index ae843a28..db435ad 100644
--- a/content/common/push_messaging.mojom
+++ b/content/common/push_messaging.mojom
@@ -79,10 +79,10 @@
 enum PushErrorType {
   ABORT = 0,
   NETWORK = 1,
-  NOT_ALLOWED = 2,
-  NOT_FOUND = 3,
-  NOT_SUPPORTED = 4,
-  UNKNOWN = 5,
+  NONE = 2,
+  NOT_ALLOWED = 3,
+  NOT_FOUND = 4,
+  NOT_SUPPORTED = 5,
   INVALID_STATE = 6,
   LAST = INVALID_STATE
 };
@@ -134,12 +134,12 @@
                array<uint8>? p256dh,
                array<uint8>? auth);
 
-  // It returns |did_unsubscribe| if is_success is true, and returns
-  // |error_type| and |error_message| if is_success is false.
+  // We use the value of |error_type| as a flag. If |error_type| == NONE, it
+  // means no error and returns |did_unsubscribe|. Else, it means there is an
+  // error and returns |error_type| and |error_message|.
   Unsubscribe(int64 service_worker_registration_id)
-             => (bool is_success,
+             => (PushErrorType error_type,
                  bool did_unsubscribe,
-                 PushErrorType error_type,
                  string? error_message);
 
   GetSubscription(int64 service_worker_registration_id)
@@ -149,13 +149,11 @@
                      array<uint8>? p256dh,
                      array<uint8>? auth);
 
-  // It returns |status| if |is_success| is true and returns |error| if
-  // |is_success| is false.
+  // We use the value of |error_type| as a flag. If |error_type| == NONE, it
+  // means no error and returns |status|. Else, it means there is an error and
+  // returns |error_type|.
   GetPermissionStatus(int64 service_worker_registration_id,
                       bool user_visible)
-                     => (bool is_success,
-                         // |status| is meaningful when (is_success == true)
-                         PushPermissionStatus status,
-                         // |error| is meaningful when (is_success == false)
-                         PushErrorType error);
+                     => (PushErrorType error_type,
+                         PushPermissionStatus status);
 };