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

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

Issue 2891453006: Check DeviceSettingsService is intialized before using. (Closed)
Patch Set: update comment 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, DBusThreadManager or DeviceSettingsService may be
92 // uninitialized on unit tests.
92 93
93 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready 94 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready
94 // (removing it now breaks tests). crbug.com/141016. 95 // (removing it now breaks tests). crbug.com/141016.
95 if (chromeos::SystemSaltGetter::IsInitialized() && 96 if (chromeos::SystemSaltGetter::IsInitialized() &&
96 chromeos::DBusThreadManager::IsInitialized()) { 97 chromeos::DBusThreadManager::IsInitialized() &&
98 chromeos::DeviceSettingsService::IsInitialized()) {
97 // Don't initialize install attributes if g_testing_install_attributes have 99 // Don't initialize install attributes if g_testing_install_attributes have
98 // been injected. 100 // been injected.
99 if (!install_attributes_) { 101 if (!install_attributes_) {
100 install_attributes_ = base::MakeUnique<chromeos::InstallAttributes>( 102 install_attributes_ = base::MakeUnique<chromeos::InstallAttributes>(
101 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()); 103 chromeos::DBusThreadManager::Get()->GetCryptohomeClient());
102 base::FilePath install_attrs_file; 104 base::FilePath install_attrs_file;
103 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, 105 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES,
104 &install_attrs_file)); 106 &install_attrs_file));
105 install_attributes_->Init(install_attrs_file); 107 install_attributes_->Init(install_attrs_file);
106 } 108 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 device_cloud_policy_manager_->device_store()->policy(); 377 device_cloud_policy_manager_->device_store()->policy();
376 if (policy_data) { 378 if (policy_data) {
377 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(), 379 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(),
378 policy_data->device_affiliation_ids().end()); 380 policy_data->device_affiliation_ids().end());
379 } 381 }
380 } 382 }
381 return affiliation_ids; 383 return affiliation_ids;
382 } 384 }
383 385
384 } // namespace policy 386 } // 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