1 // Copyright 2015 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.
5 #ifndef REMOTING_TEST_APP_REMOTING_REPORT_ISSUE_REQUEST_H_
6 #define REMOTING_TEST_APP_REMOTING_REPORT_ISSUE_REQUEST_H_
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "net/url_request/url_fetcher_delegate.h"
14 #include "remoting/test/app_remoting_service_urls.h"
20 class URLRequestContextGetter
;
26 // Calls the App Remoting service API to report an issue. This is typically
27 // used to abandon a remote host or to upload crash logs.
28 // Must be used from a thread running an IO message loop.
29 // The public method is virtual to allow for testing using a fake.
30 class AppRemotingReportIssueRequest
: public net::URLFetcherDelegate
{
32 AppRemotingReportIssueRequest();
33 ~AppRemotingReportIssueRequest() override
;
35 // Makes a service call to the ReportIssue API.
36 virtual bool Start(const std::string
& application_id
,
37 const std::string
& host_id
,
38 const std::string
& access_token
,
39 ServiceEnvironment service_environment
,
41 base::Closure done_callback
);
44 // net::URLFetcherDelegate interface.
45 void OnURLFetchComplete(const net::URLFetcher
* source
) override
;
47 // Holds the URLFetcher for the ReportIssue request.
48 scoped_ptr
<net::URLFetcher
> request_
;
50 // Provides application-specific context for the network request.
51 scoped_refptr
<remoting::URLRequestContextGetter
> request_context_getter_
;
53 // Caller-supplied callback which is signalled when the request is complete.
54 base::Closure request_complete_callback_
;
56 DISALLOW_COPY_AND_ASSIGN(AppRemotingReportIssueRequest
);
60 } // namespace remoting
62 #endif // REMOTING_TEST_APP_REMOTING_REPORT_ISSUE_REQUEST_H_