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

Unified Diff: chrome/browser/feedback/feedback_report.cc

Issue 225183018: Move feedback files into src/components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest Created 6 years, 7 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/feedback/feedback_report.cc
diff --git a/chrome/browser/feedback/feedback_report.cc b/chrome/browser/feedback/feedback_report.cc
deleted file mode 100644
index 8518d2b9448a8a477ef7e5e2f64826e0bd02346b..0000000000000000000000000000000000000000
--- a/chrome/browser/feedback/feedback_report.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2014 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 "chrome/browser/feedback/feedback_report.h"
-
-#include "base/file_util.h"
-#include "base/files/file_enumerator.h"
-#include "base/files/important_file_writer.h"
-#include "base/guid.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/threading/sequenced_worker_pool.h"
-#include "net/base/directory_lister.h"
-
-namespace {
-
-const base::FilePath::CharType kFeedbackReportFilenameWildcard[] =
- FILE_PATH_LITERAL("Feedback Report.*");
-
-const char kFeedbackReportFilenamePrefix[] = "Feedback Report.";
-
-void WriteReportOnBlockingPool(const base::FilePath reports_path,
- const base::FilePath& file,
- const std::string& data) {
- DCHECK(reports_path.IsParent(file));
- if (!base::DirectoryExists(reports_path)) {
- base::File::Error error;
- if (!base::CreateDirectoryAndGetError(reports_path, &error))
- return;
- }
- base::ImportantFileWriter::WriteFileAtomically(file, data);
-}
-
-} // namespace
-
-namespace feedback {
-
-FeedbackReport::FeedbackReport(
- const base::FilePath& path,
- const base::Time& upload_at,
- const std::string& data,
- scoped_refptr<base::SequencedTaskRunner> task_runner)
- : reports_path_(path),
- upload_at_(upload_at),
- data_(data),
- reports_task_runner_(task_runner) {
- if (reports_path_.empty())
- return;
- file_ = reports_path_.AppendASCII(
- kFeedbackReportFilenamePrefix + base::GenerateGUID());
-
- reports_task_runner_->PostTask(FROM_HERE, base::Bind(
- &WriteReportOnBlockingPool, reports_path_, file_, data_));
-}
-
-FeedbackReport::~FeedbackReport() {}
-
-void FeedbackReport::DeleteReportOnDisk() {
- reports_task_runner_->PostTask(FROM_HERE, base::Bind(
- base::IgnoreResult(&base::DeleteFile), file_, false));
-}
-
-// static
-void FeedbackReport::LoadReportsAndQueue(
- const base::FilePath& user_dir, QueueCallback callback) {
- if (user_dir.empty())
- return;
-
- base::FileEnumerator enumerator(user_dir,
- false,
- base::FileEnumerator::FILES,
- kFeedbackReportFilenameWildcard);
- for (base::FilePath name = enumerator.Next();
- !name.empty();
- name = enumerator.Next()) {
- std::string data;
- if (ReadFileToString(name, &data))
- callback.Run(data);
- base::DeleteFile(name, false);
- }
-}
-
-} // namespace feedback

Powered by Google App Engine
This is Rietveld 408576698