Home | History | Annotate | Download | only in media
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/media/webrtc_log_list.h"
      6 
      7 #include "base/files/file.h"
      8 #include "base/files/file_path.h"
      9 #include "base/files/file_util.h"
     10 #include "base/path_service.h"
     11 #include "chrome/browser/profiles/profile.h"
     12 #include "chrome/common/chrome_paths.h"
     13 
     14 namespace {
     15 
     16 const char kWebRtcLogDirectory[] = "WebRTC Logs";
     17 const char kWebRtcLogListFilename[] = "Log List";
     18 
     19 }
     20 
     21 // static
     22 UploadList* WebRtcLogList::CreateWebRtcLogList(UploadList::Delegate* delegate,
     23                                                Profile* profile) {
     24   base::FilePath log_list_path = GetWebRtcLogListFileForDirectory(
     25       GetWebRtcLogDirectoryForProfile(profile->GetPath()));
     26   return new UploadList(delegate, log_list_path);
     27 }
     28 
     29 // static
     30 base::FilePath WebRtcLogList::GetWebRtcLogDirectoryForProfile(
     31     const base::FilePath& profile_path) {
     32   DCHECK(!profile_path.empty());
     33   return profile_path.AppendASCII(kWebRtcLogDirectory);
     34 }
     35 
     36 // static
     37 base::FilePath WebRtcLogList::GetWebRtcLogListFileForDirectory(
     38     const base::FilePath& dir) {
     39   DCHECK(!dir.empty());
     40   return dir.AppendASCII(kWebRtcLogListFilename);
     41 }
     42