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

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

Issue 2702503003: [Dial] Refactor DialRegistry and DeviceDescriptionFetcher so they can be used by MediaSinkService (Closed)
Patch Set: resolve code review comments from Derek Created 3 years, 9 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.cc
diff --git a/chrome/browser/extensions/api/dial/device_description_fetcher.cc b/chrome/browser/extensions/api/dial/device_description_fetcher.cc
index 654fc3355c770bd83057e9b61b2abf9cfa3d9fe4..7be4b199367e06b3110989a1a54d1c6b8467991a 100644
--- a/chrome/browser/extensions/api/dial/device_description_fetcher.cc
+++ b/chrome/browser/extensions/api/dial/device_description_fetcher.cc
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/dial/device_description_fetcher.h"
+
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
-#include "chrome/browser/extensions/api/dial/device_description_fetcher.h"
#include "chrome/browser/extensions/api/dial/dial_device_data.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
@@ -13,6 +14,7 @@
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "net/url_request/url_fetcher.h"
+#include "net/url_request/url_request_context_getter.h"
using content::BrowserThread;
@@ -28,24 +30,23 @@ namespace dial {
DeviceDescriptionFetcher::DeviceDescriptionFetcher(
const GURL& device_description_url,
- Profile* profile,
+ net::URLRequestContextGetter* request_context,
base::OnceCallback<void(const DialDeviceDescriptionData&)> success_cb,
base::OnceCallback<void(const std::string&)> error_cb)
: device_description_url_(device_description_url),
- profile_(profile),
+ request_context_(request_context),
success_cb_(std::move(success_cb)),
error_cb_(std::move(error_cb)) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- DCHECK(profile_);
+ DCHECK(request_context_);
DCHECK(device_description_url_.is_valid());
}
DeviceDescriptionFetcher::~DeviceDescriptionFetcher() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(thread_checker_.CalledOnValidThread());
}
void DeviceDescriptionFetcher::Start() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!fetcher_);
// DIAL returns device descriptions via GET request.
@@ -70,7 +71,7 @@ void DeviceDescriptionFetcher::Start() {
fetcher_->SetMaxRetriesOn5xx(kMaxRetries);
fetcher_->SetAutomaticallyRetryOnNetworkChanges(kMaxRetries);
- fetcher_->SetRequestContext(profile_->GetRequestContext());
+ fetcher_->SetRequestContext(request_context_.get());
fetcher_->Start();
}

Powered by Google App Engine
This is Rietveld 408576698