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

Side by Side Diff: chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc

Issue 2891453006: Check DeviceSettingsService is intialized before using. (Closed)
Patch Set: Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/policy/browser_policy_connector_chromeos.h" 5 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 } // namespace 82 } // namespace
83 83
84 BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS() 84 BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS()
85 : weak_ptr_factory_(this) { 85 : weak_ptr_factory_(this) {
86 if (g_testing_install_attributes) { 86 if (g_testing_install_attributes) {
87 install_attributes_.reset(g_testing_install_attributes); 87 install_attributes_.reset(g_testing_install_attributes);
88 g_testing_install_attributes = nullptr; 88 g_testing_install_attributes = nullptr;
89 } 89 }
90 90
91 // SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests. 91 // SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests.
xiyuan 2017/05/17 19:56:36 Update this document too.
xiaoyinh(OOO Sep 11-29) 2017/05/17 20:12:27 Done.
92 92
93 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready 93 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready
94 // (removing it now breaks tests). crbug.com/141016. 94 // (removing it now breaks tests). crbug.com/141016.
95 if (chromeos::SystemSaltGetter::IsInitialized() && 95 if (chromeos::SystemSaltGetter::IsInitialized() &&
96 chromeos::DBusThreadManager::IsInitialized()) { 96 chromeos::DBusThreadManager::IsInitialized() &&
97 chromeos::DeviceSettingsService::IsInitialized()) {
97 // Don't initialize install attributes if g_testing_install_attributes have 98 // Don't initialize install attributes if g_testing_install_attributes have
98 // been injected. 99 // been injected.
99 if (!install_attributes_) { 100 if (!install_attributes_) {
100 install_attributes_ = base::MakeUnique<chromeos::InstallAttributes>( 101 install_attributes_ = base::MakeUnique<chromeos::InstallAttributes>(
101 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()); 102 chromeos::DBusThreadManager::Get()->GetCryptohomeClient());
102 base::FilePath install_attrs_file; 103 base::FilePath install_attrs_file;
103 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, 104 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES,
104 &install_attrs_file)); 105 &install_attrs_file));
105 install_attributes_->Init(install_attrs_file); 106 install_attributes_->Init(install_attrs_file);
106 } 107 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 device_cloud_policy_manager_->device_store()->policy(); 376 device_cloud_policy_manager_->device_store()->policy();
376 if (policy_data) { 377 if (policy_data) {
377 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(), 378 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(),
378 policy_data->device_affiliation_ids().end()); 379 policy_data->device_affiliation_ids().end());
379 } 380 }
380 } 381 }
381 return affiliation_ids; 382 return affiliation_ids;
382 } 383 }
383 384
384 } // namespace policy 385 } // namespace policy
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