OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/device_management_backend_impl.h" | 5 #include "chrome/browser/policy/device_management_backend_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 for (JobSet::iterator job(pending_jobs_.begin()); | 466 for (JobSet::iterator job(pending_jobs_.begin()); |
467 job != pending_jobs_.end(); | 467 job != pending_jobs_.end(); |
468 ++job) { | 468 ++job) { |
469 service_->RemoveJob(*job); | 469 service_->RemoveJob(*job); |
470 delete *job; | 470 delete *job; |
471 } | 471 } |
472 pending_jobs_.clear(); | 472 pending_jobs_.clear(); |
473 } | 473 } |
474 | 474 |
475 std::string DeviceManagementBackendImpl::GetAgentString() { | 475 std::string DeviceManagementBackendImpl::GetAgentString() { |
476 static std::string agent; | 476 CR_DEFINE_STATIC_LOCAL(std::string, agent, ()); |
477 if (!agent.empty()) | 477 if (!agent.empty()) |
478 return agent; | 478 return agent; |
479 | 479 |
480 chrome::VersionInfo version_info; | 480 chrome::VersionInfo version_info; |
481 agent = base::StringPrintf(kValueAgent, | 481 agent = base::StringPrintf(kValueAgent, |
482 version_info.Name().c_str(), | 482 version_info.Name().c_str(), |
483 version_info.Version().c_str(), | 483 version_info.Version().c_str(), |
484 version_info.LastChange().c_str()); | 484 version_info.LastChange().c_str()); |
485 return agent; | 485 return agent; |
486 } | 486 } |
487 | 487 |
488 std::string DeviceManagementBackendImpl::GetPlatformString() { | 488 std::string DeviceManagementBackendImpl::GetPlatformString() { |
489 static std::string platform; | 489 CR_DEFINE_STATIC_LOCAL(std::string, platform, ()); |
490 if (!platform.empty()) | 490 if (!platform.empty()) |
491 return platform; | 491 return platform; |
492 | 492 |
493 std::string os_name(base::SysInfo::OperatingSystemName()); | 493 std::string os_name(base::SysInfo::OperatingSystemName()); |
494 std::string os_hardware(base::SysInfo::CPUArchitecture()); | 494 std::string os_hardware(base::SysInfo::CPUArchitecture()); |
495 | 495 |
496 #if defined(OS_CHROMEOS) | 496 #if defined(OS_CHROMEOS) |
497 chromeos::system::StatisticsProvider* provider = | 497 chromeos::system::StatisticsProvider* provider = |
498 chromeos::system::StatisticsProvider::GetInstance(); | 498 chromeos::system::StatisticsProvider::GetInstance(); |
499 | 499 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 case CloudPolicyDataStore::USER_AFFILIATION_MANAGED: | 578 case CloudPolicyDataStore::USER_AFFILIATION_MANAGED: |
579 return kValueUserAffiliationManaged; | 579 return kValueUserAffiliationManaged; |
580 case CloudPolicyDataStore::USER_AFFILIATION_NONE: | 580 case CloudPolicyDataStore::USER_AFFILIATION_NONE: |
581 return kValueUserAffiliationNone; | 581 return kValueUserAffiliationNone; |
582 } | 582 } |
583 NOTREACHED(); | 583 NOTREACHED(); |
584 return kValueUserAffiliationNone; | 584 return kValueUserAffiliationNone; |
585 } | 585 } |
586 | 586 |
587 } // namespace policy | 587 } // namespace policy |
OLD | NEW |