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

Unified Diff: content/common/download/mhtml_save_status.cc

Issue 2519273002: Fail when saving page as MHTML provides information about the cause. (Closed)
Patch Set: Addressed code review comments. Created 4 years, 1 month 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: content/common/download/mhtml_save_status.cc
diff --git a/content/common/download/mhtml_save_status.cc b/content/common/download/mhtml_save_status.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3c0c4b206a63d3bb92eb66eb20e72ebb998be260
--- /dev/null
+++ b/content/common/download/mhtml_save_status.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/download/mhtml_save_status.h"
+
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
nasko 2016/11/23 18:07:34 Why is this include needed?
carlosk 2016/11/23 20:08:40 My mistake. Removed.
+
+namespace content {
+
+const char* GetMhtmlSaveStatusLabel(MhtmlSaveStatus save_status) {
+ switch (save_status) {
+ case MhtmlSaveStatus::SUCCESS:
+ return "Success";
+ case MhtmlSaveStatus::FILE_CLOSING_ERROR:
+ return "File closing error";
+ case MhtmlSaveStatus::FILE_CREATION_ERROR:
+ return "File creation error";
+ case MhtmlSaveStatus::FILE_WRITTING_ERROR:
+ return "File writing error";
+ case MhtmlSaveStatus::FRAME_NO_LONGER_EXISTS:
+ return "Frame no longer exists";
+ case MhtmlSaveStatus::FRAME_SERIALIZATION_FORBIDDEN:
+ return "Main frame serialization forbidden";
+ case MhtmlSaveStatus::RENDER_PROCESS_EXITED:
+ return "Render process no longer exists";
+ case MhtmlSaveStatus::STATUS_COUNT:
+ break;
+ }
+ NOTREACHED();
+ return "INVALID STATUS";
nasko 2016/11/23 18:07:34 Keep strings consistent - you don't use all caps a
carlosk 2016/11/23 20:08:40 This seemed like a big enough error case to flag i
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698