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

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

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
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_service.h" 5 #include "chrome/browser/extensions/api/dial/dial_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 DVLOG(1) << "Headers invalid or empty, ignoring: " << response; 343 DVLOG(1) << "Headers invalid or empty, ignoring: " << response;
344 return false; 344 return false;
345 } 345 }
346 std::string raw_headers = 346 std::string raw_headers =
347 HttpUtil::AssembleRawHeaders(response.c_str(), headers_end); 347 HttpUtil::AssembleRawHeaders(response.c_str(), headers_end);
348 DVLOG(1) << "raw_headers: " << raw_headers << "\n"; 348 DVLOG(1) << "raw_headers: " << raw_headers << "\n";
349 scoped_refptr<HttpResponseHeaders> headers = 349 scoped_refptr<HttpResponseHeaders> headers =
350 new HttpResponseHeaders(raw_headers); 350 new HttpResponseHeaders(raw_headers);
351 351
352 std::string device_url_str; 352 std::string device_url_str;
353 if (!GetHeader(headers, kSsdpLocationHeader, &device_url_str) || 353 if (!GetHeader(headers.get(), kSsdpLocationHeader, &device_url_str) ||
354 device_url_str.empty()) { 354 device_url_str.empty()) {
355 DVLOG(1) << "No LOCATION header found."; 355 DVLOG(1) << "No LOCATION header found.";
356 return false; 356 return false;
357 } 357 }
358 358
359 GURL device_url(device_url_str); 359 GURL device_url(device_url_str);
360 if (!DialDeviceData::IsDeviceDescriptionUrl(device_url)) { 360 if (!DialDeviceData::IsDeviceDescriptionUrl(device_url)) {
361 DVLOG(1) << "URL " << device_url_str << " not valid."; 361 DVLOG(1) << "URL " << device_url_str << " not valid.";
362 return false; 362 return false;
363 } 363 }
364 364
365 std::string device_id; 365 std::string device_id;
366 if (!GetHeader(headers, kSsdpUsnHeader, &device_id) || device_id.empty()) { 366 if (!GetHeader(headers.get(), kSsdpUsnHeader, &device_id) ||
367 device_id.empty()) {
367 DVLOG(1) << "No USN header found."; 368 DVLOG(1) << "No USN header found.";
368 return false; 369 return false;
369 } 370 }
370 371
371 device->set_device_id(device_id); 372 device->set_device_id(device_id);
372 device->set_device_description_url(device_url); 373 device->set_device_description_url(device_url);
373 device->set_response_time(response_time); 374 device->set_response_time(response_time);
374 375
375 // TODO(mfoltz): Parse the max-age value from the cache control header. 376 // TODO(mfoltz): Parse the max-age value from the cache control header.
376 // http://crbug.com/165289 377 // http://crbug.com/165289
377 std::string cache_control; 378 std::string cache_control;
378 GetHeader(headers, kSsdpCacheControlHeader, &cache_control); 379 GetHeader(headers.get(), kSsdpCacheControlHeader, &cache_control);
379 380
380 std::string config_id; 381 std::string config_id;
381 int config_id_int; 382 int config_id_int;
382 if (GetHeader(headers, kSsdpConfigIdHeader, &config_id) && 383 if (GetHeader(headers.get(), kSsdpConfigIdHeader, &config_id) &&
383 base::StringToInt(config_id, &config_id_int)) { 384 base::StringToInt(config_id, &config_id_int)) {
384 device->set_config_id(config_id_int); 385 device->set_config_id(config_id_int);
385 } else { 386 } else {
386 DVLOG(1) << "Malformed or missing " << kSsdpConfigIdHeader << ": " 387 DVLOG(1) << "Malformed or missing " << kSsdpConfigIdHeader << ": "
387 << config_id; 388 << config_id;
388 } 389 }
389 390
390 return true; 391 return true;
391 } 392 }
392 393
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 DVLOG(0) << "dial socket error: " << error_str; 444 DVLOG(0) << "dial socket error: " << error_str;
444 // TODO(justinlin): More granular socket errors. 445 // TODO(justinlin): More granular socket errors.
445 FOR_EACH_OBSERVER( 446 FOR_EACH_OBSERVER(
446 Observer, observer_list_, OnError(this, DIAL_SERVICE_SOCKET_ERROR)); 447 Observer, observer_list_, OnError(this, DIAL_SERVICE_SOCKET_ERROR));
447 return false; 448 return false;
448 } 449 }
449 return true; 450 return true;
450 } 451 }
451 452
452 } // namespace extensions 453 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698