summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/webrtc_log_list.cc
blob: 531f7070019b6b5c876779742ab0460d352011ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 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/media/webrtc_log_list.h"

#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"

namespace {

const char kWebRtcLogDirectory[] = "WebRTC Logs";
const char kWebRtcLogListFilename[] = "Log List";

}

// static
UploadList* WebRtcLogList::CreateWebRtcLogList(UploadList::Delegate* delegate,
                                               Profile* profile) {
  base::FilePath log_list_path = GetWebRtcLogListFileForDirectory(
      GetWebRtcLogDirectoryForProfile(profile->GetPath()));
  return new UploadList(delegate, log_list_path);
}

// static
base::FilePath WebRtcLogList::GetWebRtcLogDirectoryForProfile(
    const base::FilePath& profile_path) {
  DCHECK(!profile_path.empty());
  return profile_path.AppendASCII(kWebRtcLogDirectory);
}

// static
base::FilePath WebRtcLogList::GetWebRtcLogListFileForDirectory(
    const base::FilePath& dir) {
  DCHECK(!dir.empty());
  return dir.AppendASCII(kWebRtcLogListFilename);
}