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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_api.cc

Issue 2668383004: [DIAL] Break circular dependency in DialFetchDeviceDescriptionFunction. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/dial/dial_api.h" 5 #include "chrome/browser/extensions/api/dial/dial_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 device_description_fetcher_ = base::MakeUnique<DeviceDescriptionFetcher>( 232 device_description_fetcher_ = base::MakeUnique<DeviceDescriptionFetcher>(
233 url, Profile::FromBrowserContext(browser_context()), 233 url, Profile::FromBrowserContext(browser_context()),
234 base::BindOnce(&DialFetchDeviceDescriptionFunction::OnFetchComplete, 234 base::BindOnce(&DialFetchDeviceDescriptionFunction::OnFetchComplete,
235 this), 235 this),
236 base::BindOnce(&DialFetchDeviceDescriptionFunction::OnFetchError, this)); 236 base::BindOnce(&DialFetchDeviceDescriptionFunction::OnFetchError, this));
237 237
238 device_description_fetcher_->Start(); 238 device_description_fetcher_->Start();
239 } 239 }
240 240
241 void DialFetchDeviceDescriptionFunction::OnFetchComplete( 241 void DialFetchDeviceDescriptionFunction::OnFetchComplete(
mark a. foltz 2017/02/02 20:27:32 Can you add a comment in device_description_fetche
imcheng 2017/02/02 20:44:31 I added comment here explaining why we have to des
242 const api::dial::DialDeviceDescriptionData& result) { 242 const api::dial::DialDeviceDescriptionData& result) {
243 device_description_fetcher_.reset();
mark a. foltz 2017/02/02 20:27:32 Would resetting the non-invoked callback in Device
imcheng 2017/02/02 20:44:31 Yes, that would work too. But I see no reason to h
243 api::dial::DialDeviceDescription device_description; 244 api::dial::DialDeviceDescription device_description;
244 device_description.device_label = params_->device_label; 245 device_description.device_label = params_->device_label;
245 device_description.app_url = result.app_url.spec(); 246 device_description.app_url = result.app_url.spec();
246 device_description.device_description = result.device_description; 247 device_description.device_description = result.device_description;
247 SetResult(device_description.ToValue()); 248 SetResult(device_description.ToValue());
248 SendResponse(true); 249 SendResponse(true);
249 } 250 }
250 251
251 void DialFetchDeviceDescriptionFunction::OnFetchError( 252 void DialFetchDeviceDescriptionFunction::OnFetchError(
252 const std::string& message) { 253 const std::string& message) {
254 device_description_fetcher_.reset();
253 SetError(message); 255 SetError(message);
254 SendResponse(false); 256 SendResponse(false);
255 } 257 }
256 258
257 } // namespace extensions 259 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698