summaryrefslogtreecommitdiffstats
path: root/ios/chrome/browser/crash_report/crash_report_background_uploader.h
blob: 3469293ed46f63ba04066c3ef652460da3ea0489 (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
42
43
44
// 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.

#ifndef IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORT_BACKGROUND_UPLOADER_H_
#define IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORT_BACKGROUND_UPLOADER_H_

#import <UIKit/UIKit.h>

#include "base/ios/block_types.h"

typedef void (^BackgroundFetchCompletionBlock)(UIBackgroundFetchResult);

@interface CrashReportBackgroundUploader : NSObject

+ (instancetype)sharedInstance;

// Handler for the application delegate |performFetchWithCompletionHandler|
// message. Sends the next breakpad report if available.
+ (void)performFetchWithCompletionHandler:
        (BackgroundFetchCompletionBlock)completionHandler;

// Handler for the application delegate |handleEventsForBackgroundURLSession|
// message. Retrieves info from the URL Session.
+ (void)handleEventsForBackgroundURLSession:(NSString*)identifier
                          completionHandler:(ProceduralBlock)completionHandler;

// Returns YES if the session is a breakpad upload session.
+ (BOOL)canHandleBackgroundURLSession:(NSString*)identifier;

// Returns YES if crash reports where uploaded in the background.
+ (BOOL)hasUploadedCrashReportsInBackground;

// Resets the number of crash reports that have been uploaded.
+ (void)resetReportsUploadedInBackgroundCount;

// Flag to determine if there are any pending crash reports on startup. This is
// not an indication that there are pending crash reports at the moment this
// flag is checked.
@property(nonatomic, assign) BOOL hasPendingCrashReportsToUploadAtStartup;

@end

#endif  // IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORT_BACKGROUND_UPLOADER_H_