Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Unified Diff: chrome/browser/extensions/api/dial/device_description_fetcher.h

Issue 2702503003: [Dial] Refactor DialRegistry and DeviceDescriptionFetcher so they can be used by MediaSinkService (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/dial/device_description_fetcher.h
diff --git a/chrome/browser/extensions/api/dial/device_description_fetcher.h b/chrome/browser/extensions/api/dial/device_description_fetcher.h
index 309dc88a60007e340790bdd540412560125c73d2..0522444795b1312ce268047de9a67ae3706657b0 100644
--- a/chrome/browser/extensions/api/dial/device_description_fetcher.h
+++ b/chrome/browser/extensions/api/dial/device_description_fetcher.h
@@ -9,13 +9,13 @@
#include <string>
#include "base/callback.h"
+#include "content/public/browser/browser_thread.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "url/gurl.h"
-class Profile;
-
namespace net {
class URLFetcher;
+class URLRequestContextGetter;
}
namespace extensions {
@@ -27,17 +27,19 @@ struct DialDeviceDescriptionData;
// Used to make a single HTTP GET request with |device_description_url| to fetch
// a uPnP device description from a DIAL device. If successful, |success_cb| is
// invoked with the result; otherwise, |error_cb| is invoked with an error
-// reason. This class is not thread safe and must be used on the UI thread.
+// reason.
+// This class is not thread safe and must be used on the UI or IO thread.
mark a. foltz 2017/03/01 21:44:00 It's safe to use the URLFetcher from either thread
zhaobin 2017/03/02 07:04:35 Done.
class DeviceDescriptionFetcher : public net::URLFetcherDelegate {
imcheng 2017/02/22 03:45:04 I would make it clear that an instance must only b
zhaobin 2017/03/02 07:04:35 Acknowledged.
public:
// Used to identify the net::URLFetcher instance for tests.
static constexpr int kURLFetcherIDForTest = 1;
- // |profile| is unowned; the caller must ensure that this object does not
- // outlive it.
+ // |request_context| is unowned; the caller must ensure that this object does
+ // not outlive it.
DeviceDescriptionFetcher(
const GURL& device_description_url,
- Profile* profile,
+ net::URLRequestContextGetter* request_context,
+ content::BrowserThread::ID thread_id,
base::OnceCallback<void(const DialDeviceDescriptionData&)> success_cb,
base::OnceCallback<void(const std::string&)> error_cb);
@@ -60,7 +62,9 @@ class DeviceDescriptionFetcher : public net::URLFetcherDelegate {
void ReportError(const std::string& message);
const GURL device_description_url_;
- Profile* const profile_;
+ net::URLRequestContextGetter* const request_context_;
+ content::BrowserThread::ID thread_id_;
+
base::OnceCallback<void(const DialDeviceDescriptionData&)> success_cb_;
base::OnceCallback<void(const std::string&)> error_cb_;
std::unique_ptr<net::URLFetcher> fetcher_;

Powered by Google App Engine
This is Rietveld 408576698