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

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

Issue 2674573011: [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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
242 const api::dial::DialDeviceDescriptionData& result) { 242 const api::dial::DialDeviceDescriptionData& result) {
243 // Destroy the DeviceDescriptionFetcher since it still contains a reference
244 // to |this| in its un-invoked callback.
245 device_description_fetcher_.reset();
243 api::dial::DialDeviceDescription device_description; 246 api::dial::DialDeviceDescription device_description;
244 device_description.device_label = params_->device_label; 247 device_description.device_label = params_->device_label;
245 device_description.app_url = result.app_url.spec(); 248 device_description.app_url = result.app_url.spec();
246 device_description.device_description = result.device_description; 249 device_description.device_description = result.device_description;
247 SetResult(device_description.ToValue()); 250 SetResult(device_description.ToValue());
248 SendResponse(true); 251 SendResponse(true);
249 } 252 }
250 253
251 void DialFetchDeviceDescriptionFunction::OnFetchError( 254 void DialFetchDeviceDescriptionFunction::OnFetchError(
252 const std::string& message) { 255 const std::string& message) {
256 // Destroy the DeviceDescriptionFetcher since it still contains a reference
257 // to |this| in its un-invoked callback.
258 device_description_fetcher_.reset();
253 SetError(message); 259 SetError(message);
254 SendResponse(false); 260 SendResponse(false);
255 } 261 }
256 262
257 } // namespace extensions 263 } // 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