Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / remoting / test / app_remoting_report_issue_request.h
blob43548e57b20454b572c337e5f1f84c7ddf84d83f
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_
8 #include <string>
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"
16 namespace net {
17 class UrlFetcher;
19 namespace remoting {
20 class URLRequestContextGetter;
23 namespace remoting {
24 namespace test {
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 {
31 public:
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,
40 bool abandon_host,
41 base::Closure done_callback);
43 private:
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);
59 } // namespace test
60 } // namespace remoting
62 #endif // REMOTING_TEST_APP_REMOTING_REPORT_ISSUE_REQUEST_H_