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

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

Issue 493613002: Add an enrolling state for consumer management section in settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dn
Patch Set: Created 6 years, 4 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
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/consumer_management_service.h" 5 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h"
bartfab (slow) 2014/08/21 11:39:35 Nit: Already included by the header file.
davidyu 2014/08/22 05:14:13 Done.
11 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
12 #include "base/prefs/pref_registry_simple.h" 13 #include "base/prefs/pref_registry_simple.h"
13 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/browser_process_platform_part.h" 18 #include "chrome/browser/browser_process_platform_part.h"
18 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
20 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" 21 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 55
55 namespace { 56 namespace {
56 57
57 // Boot atttributes ID. 58 // Boot atttributes ID.
58 const char kAttributeOwnerId[] = "consumer_management.owner_id"; 59 const char kAttributeOwnerId[] = "consumer_management.owner_id";
59 60
60 // Desktop notification constants. 61 // Desktop notification constants.
61 const char kEnrollmentNotificationId[] = "consumer_management.enroll"; 62 const char kEnrollmentNotificationId[] = "consumer_management.enroll";
62 const char kEnrollmentNotificationUrl[] = "chrome://consumer-management/enroll"; 63 const char kEnrollmentNotificationUrl[] = "chrome://consumer-management/enroll";
63 64
64 // The relative path to the settings page URL for opening the consumer 65 // The relative path to the settings page URL for opening the consumer
bartfab (slow) 2014/08/21 11:39:35 How about: The path to the consumer management en
davidyu 2014/08/22 05:14:12 Done.
65 // management enrollment/unenrollment confirmation overlay. 66 // management enrollment/unenrollment confirmation overlay.
66 const char kConsumerManagementOverlay[] = "consumer-management-overlay"; 67 const char kConsumerManagementOverlay[] = "consumer-management-overlay";
67 68
69 // The string of Status enum.
70 const char* kStatusString[] = {
71 "STATUS_UNKNOWN",
72 "STATUS_ENROLLED",
73 "STATUS_ENROLLING",
74 "STATUS_UNENROLLED",
75 "STATUS_UNENROLLING",
76 };
77
78 COMPILE_ASSERT(
79 arraysize(kStatusString) == policy::ConsumerManagementService::STATUS_LAST,
80 "invalid kStatusString array size.");
81
68 } // namespace 82 } // namespace
69 83
84 namespace em = enterprise_management;
85
70 namespace policy { 86 namespace policy {
71 87
72 ConsumerManagementService::ConsumerManagementService( 88 ConsumerManagementService::ConsumerManagementService(
73 chromeos::CryptohomeClient* client) 89 chromeos::CryptohomeClient* client,
90 chromeos::DeviceSettingsService* device_settings_service)
74 : Consumer("consumer_management_service"), 91 : Consumer("consumer_management_service"),
75 client_(client), 92 client_(client),
93 device_settings_service_(device_settings_service),
76 enrolling_profile_(NULL), 94 enrolling_profile_(NULL),
77 weak_ptr_factory_(this) { 95 weak_ptr_factory_(this) {
78 registrar_.Add(this, 96 registrar_.Add(this,
79 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 97 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
80 content::NotificationService::AllSources()); 98 content::NotificationService::AllSources());
99 // A NULL value may be passed in the test.
bartfab (slow) 2014/08/21 11:39:35 Nit: s/the test/tests/
davidyu 2014/08/22 05:14:13 Done.
100 if (device_settings_service_)
101 device_settings_service_->AddObserver(this);
81 } 102 }
82 103
83 ConsumerManagementService::~ConsumerManagementService() { 104 ConsumerManagementService::~ConsumerManagementService() {
84 registrar_.Remove(this,
85 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
86 content::NotificationService::AllSources());
87 if (enrolling_profile_) { 105 if (enrolling_profile_) {
88 ProfileOAuth2TokenServiceFactory::GetForProfile(enrolling_profile_)-> 106 ProfileOAuth2TokenServiceFactory::GetForProfile(enrolling_profile_)->
89 RemoveObserver(this); 107 RemoveObserver(this);
90 } 108 }
109 if (device_settings_service_)
110 device_settings_service_->RemoveObserver(this);
111 registrar_.Remove(this,
112 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
113 content::NotificationService::AllSources());
91 } 114 }
92 115
93 // static 116 // static
94 void ConsumerManagementService::RegisterPrefs(PrefRegistrySimple* registry) { 117 void ConsumerManagementService::RegisterPrefs(PrefRegistrySimple* registry) {
95 registry->RegisterIntegerPref( 118 registry->RegisterIntegerPref(
96 prefs::kConsumerManagementEnrollmentState, ENROLLMENT_NONE); 119 prefs::kConsumerManagementEnrollmentStage, ENROLLMENT_STAGE_NONE);
97 } 120 }
98 121
99 ConsumerManagementService::ConsumerEnrollmentState 122 void ConsumerManagementService::AddObserver(Observer* observer) {
100 ConsumerManagementService::GetEnrollmentState() const { 123 observers_.AddObserver(observer);
101 const PrefService* prefs = g_browser_process->local_state();
102 int state = prefs->GetInteger(prefs::kConsumerManagementEnrollmentState);
103 if (state < 0 || state >= ENROLLMENT_LAST) {
104 LOG(ERROR) << "Unknown enrollment state: " << state;
105 state = 0;
106 }
107 return static_cast<ConsumerEnrollmentState>(state);
108 } 124 }
109 125
110 void ConsumerManagementService::SetEnrollmentState( 126 void ConsumerManagementService::RemoveObserver(Observer* observer) {
111 ConsumerEnrollmentState state) { 127 observers_.RemoveObserver(observer);
128 }
129
130 ConsumerManagementService::Status
131 ConsumerManagementService::GetStatus() const {
132 if (!device_settings_service_)
133 return STATUS_UNKNOWN;
134
135 const enterprise_management::PolicyData* policy_data =
136 device_settings_service_->policy_data();
137 if (!policy_data)
138 return STATUS_UNKNOWN;
139
140 if (policy_data->management_mode() == em::PolicyData::CONSUMER_MANAGED) {
141 // TODO(davidyu): Check if unenrollment is in progress.
142 // http://crbug.com/353050.
143 return STATUS_ENROLLED;
144 } else {
bartfab (slow) 2014/08/21 11:39:35 Nit: The style guide forbids else after a return i
davidyu 2014/08/22 05:14:13 Done.
145 EnrollmentStage stage = GetEnrollmentStage();
146 if (stage > ENROLLMENT_STAGE_NONE && stage < ENROLLMENT_STAGE_SUCCESS)
147 return STATUS_ENROLLING;
148 else
bartfab (slow) 2014/08/21 11:39:35 Nit: The style guide forbids else after a return i
davidyu 2014/08/22 05:14:13 Done.
149 return STATUS_UNENROLLED;
150 }
151 }
152
153 // static
154 std::string ConsumerManagementService::GetStatusString(Status status) {
155 if (status < 0 || status >= STATUS_LAST)
156 status = STATUS_UNKNOWN;
157 return kStatusString[status];
158 }
159
160 ConsumerManagementService::EnrollmentStage
161 ConsumerManagementService::GetEnrollmentStage() const {
162 const PrefService* prefs = g_browser_process->local_state();
163 int stage = prefs->GetInteger(prefs::kConsumerManagementEnrollmentStage);
164 if (stage < 0 || stage >= ENROLLMENT_STAGE_LAST) {
165 LOG(ERROR) << "Unknown enrollment stage: " << stage;
166 stage = 0;
167 }
168 return static_cast<EnrollmentStage>(stage);
169 }
170
171 void ConsumerManagementService::SetEnrollmentStage(EnrollmentStage stage) {
112 PrefService* prefs = g_browser_process->local_state(); 172 PrefService* prefs = g_browser_process->local_state();
113 prefs->SetInteger(prefs::kConsumerManagementEnrollmentState, state); 173 prefs->SetInteger(prefs::kConsumerManagementEnrollmentStage, stage);
174
175 NotifyStatusChanged();
114 } 176 }
115 177
116 void ConsumerManagementService::GetOwner(const GetOwnerCallback& callback) { 178 void ConsumerManagementService::GetOwner(const GetOwnerCallback& callback) {
117 cryptohome::GetBootAttributeRequest request; 179 cryptohome::GetBootAttributeRequest request;
118 request.set_name(kAttributeOwnerId); 180 request.set_name(kAttributeOwnerId);
119 client_->GetBootAttribute( 181 client_->GetBootAttribute(
120 request, 182 request,
121 base::Bind(&ConsumerManagementService::OnGetBootAttributeDone, 183 base::Bind(&ConsumerManagementService::OnGetBootAttributeDone,
122 weak_ptr_factory_.GetWeakPtr(), 184 weak_ptr_factory_.GetWeakPtr(),
123 callback)); 185 callback));
124 } 186 }
125 187
126 void ConsumerManagementService::SetOwner(const std::string& user_id, 188 void ConsumerManagementService::SetOwner(const std::string& user_id,
127 const SetOwnerCallback& callback) { 189 const SetOwnerCallback& callback) {
128 cryptohome::SetBootAttributeRequest request; 190 cryptohome::SetBootAttributeRequest request;
129 request.set_name(kAttributeOwnerId); 191 request.set_name(kAttributeOwnerId);
130 request.set_value(user_id.data(), user_id.size()); 192 request.set_value(user_id.data(), user_id.size());
131 client_->SetBootAttribute( 193 client_->SetBootAttribute(
132 request, 194 request,
133 base::Bind(&ConsumerManagementService::OnSetBootAttributeDone, 195 base::Bind(&ConsumerManagementService::OnSetBootAttributeDone,
134 weak_ptr_factory_.GetWeakPtr(), 196 weak_ptr_factory_.GetWeakPtr(),
135 callback)); 197 callback));
136 } 198 }
137 199
200 void ConsumerManagementService::OwnershipStatusChanged() {
201 }
202
203 void ConsumerManagementService::DeviceSettingsUpdated() {
204 NotifyStatusChanged();
205 }
206
138 void ConsumerManagementService::Observe( 207 void ConsumerManagementService::Observe(
139 int type, 208 int type,
140 const content::NotificationSource& source, 209 const content::NotificationSource& source,
141 const content::NotificationDetails& details) { 210 const content::NotificationDetails& details) {
142 if (type != chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED) { 211 if (type != chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED) {
143 NOTREACHED() << "Unexpected notification " << type; 212 NOTREACHED() << "Unexpected notification " << type;
144 return; 213 return;
145 } 214 }
146 215
147 Profile* profile = content::Details<Profile>(details).ptr(); 216 Profile* profile = content::Details<Profile>(details).ptr();
(...skipping 22 matching lines...) Expand all
170 OnOwnerAccessTokenAvailable(access_token); 239 OnOwnerAccessTokenAvailable(access_token);
171 } 240 }
172 241
173 void ConsumerManagementService::OnGetTokenFailure( 242 void ConsumerManagementService::OnGetTokenFailure(
174 const OAuth2TokenService::Request* request, 243 const OAuth2TokenService::Request* request,
175 const GoogleServiceAuthError& error) { 244 const GoogleServiceAuthError& error) {
176 DCHECK_EQ(token_request_, request); 245 DCHECK_EQ(token_request_, request);
177 base::MessageLoop::current()->DeleteSoon(FROM_HERE, token_request_.release()); 246 base::MessageLoop::current()->DeleteSoon(FROM_HERE, token_request_.release());
178 247
179 LOG(ERROR) << "Failed to get the access token: " << error.ToString(); 248 LOG(ERROR) << "Failed to get the access token: " << error.ToString();
180 EndEnrollment(ENROLLMENT_GET_TOKEN_FAILED); 249 EndEnrollment(ENROLLMENT_STAGE_GET_TOKEN_FAILED);
181 } 250 }
182 251
183 ConsumerManagementService::DesktopNotificationDelegate:: 252 ConsumerManagementService::DesktopNotificationDelegate::
184 DesktopNotificationDelegate( 253 DesktopNotificationDelegate(
185 const std::string& id, 254 const std::string& id,
186 const base::Closure& button_click_callback) 255 const base::Closure& button_click_callback)
187 : id_(id), 256 : id_(id),
188 button_click_callback_(button_click_callback) { 257 button_click_callback_(button_click_callback) {
189 } 258 }
190 259
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 if (!dbus_success || reply.error() != 0) { 330 if (!dbus_success || reply.error() != 0) {
262 LOG(ERROR) << "Failed to flush and sign boot lockbox."; 331 LOG(ERROR) << "Failed to flush and sign boot lockbox.";
263 callback.Run(false); 332 callback.Run(false);
264 return; 333 return;
265 } 334 }
266 335
267 callback.Run(true); 336 callback.Run(true);
268 } 337 }
269 338
270 void ConsumerManagementService::OnOwnerSignin(Profile* profile) { 339 void ConsumerManagementService::OnOwnerSignin(Profile* profile) {
271 const ConsumerEnrollmentState state = GetEnrollmentState(); 340 const EnrollmentStage stage = GetEnrollmentStage();
272 switch (state) { 341 switch (stage) {
273 case ENROLLMENT_NONE: 342 case ENROLLMENT_STAGE_NONE:
274 // Do nothing. 343 // Do nothing.
275 return; 344 return;
276 345
277 case ENROLLMENT_OWNER_STORED: 346 case ENROLLMENT_STAGE_OWNER_STORED:
278 // Continue the enrollment process after the owner signs in. 347 // Continue the enrollment process after the owner signs in.
279 ContinueEnrollmentProcess(profile); 348 ContinueEnrollmentProcess(profile);
280 return; 349 return;
281 350
282 case ENROLLMENT_SUCCESS: 351 case ENROLLMENT_STAGE_SUCCESS:
283 case ENROLLMENT_CANCELED: 352 case ENROLLMENT_STAGE_CANCELED:
284 case ENROLLMENT_BOOT_LOCKBOX_FAILED: 353 case ENROLLMENT_STAGE_BOOT_LOCKBOX_FAILED:
285 case ENROLLMENT_DM_SERVER_FAILED: 354 case ENROLLMENT_STAGE_DM_SERVER_FAILED:
286 case ENROLLMENT_GET_TOKEN_FAILED: 355 case ENROLLMENT_STAGE_GET_TOKEN_FAILED:
287 ShowDesktopNotificationAndResetState(state, profile); 356 ShowDesktopNotificationAndResetStage(stage, profile);
288 return; 357 return;
289 358
290 case ENROLLMENT_REQUESTED: 359 case ENROLLMENT_STAGE_REQUESTED:
291 case ENROLLMENT_LAST: 360 case ENROLLMENT_STAGE_LAST:
292 NOTREACHED() << "Unexpected enrollment state " << state; 361 NOTREACHED() << "Unexpected enrollment stage " << stage;
293 return; 362 return;
294 } 363 }
295 } 364 }
296 365
297 void ConsumerManagementService::ContinueEnrollmentProcess(Profile* profile) { 366 void ConsumerManagementService::ContinueEnrollmentProcess(Profile* profile) {
298 enrolling_profile_ = profile; 367 enrolling_profile_ = profile;
299 368
300 // First, we need to ensure that the refresh token is available. 369 // First, we need to ensure that the refresh token is available.
301 const std::string account_id = GetAccountIdFromProfile(profile); 370 const std::string account_id = GetAccountIdFromProfile(profile);
302 ProfileOAuth2TokenService* token_service = 371 ProfileOAuth2TokenService* token_service =
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 413 }
345 414
346 void ConsumerManagementService::OnEnrollmentCompleted(EnrollmentStatus status) { 415 void ConsumerManagementService::OnEnrollmentCompleted(EnrollmentStatus status) {
347 if (status.status() != EnrollmentStatus::STATUS_SUCCESS) { 416 if (status.status() != EnrollmentStatus::STATUS_SUCCESS) {
348 LOG(ERROR) << "Failed to enroll the device." 417 LOG(ERROR) << "Failed to enroll the device."
349 << " status=" << status.status() 418 << " status=" << status.status()
350 << " client_status=" << status.client_status() 419 << " client_status=" << status.client_status()
351 << " http_status=" << status.http_status() 420 << " http_status=" << status.http_status()
352 << " store_status=" << status.store_status() 421 << " store_status=" << status.store_status()
353 << " validation_status=" << status.validation_status(); 422 << " validation_status=" << status.validation_status();
354 EndEnrollment(ENROLLMENT_DM_SERVER_FAILED); 423 EndEnrollment(ENROLLMENT_STAGE_DM_SERVER_FAILED);
355 return; 424 return;
356 } 425 }
357 426
358 EndEnrollment(ENROLLMENT_SUCCESS); 427 EndEnrollment(ENROLLMENT_STAGE_SUCCESS);
359 } 428 }
360 429
361 void ConsumerManagementService::EndEnrollment(ConsumerEnrollmentState state) { 430 void ConsumerManagementService::EndEnrollment(EnrollmentStage stage) {
362 Profile* profile = enrolling_profile_; 431 Profile* profile = enrolling_profile_;
363 enrolling_profile_ = NULL; 432 enrolling_profile_ = NULL;
364 433
365 SetEnrollmentState(state); 434 SetEnrollmentStage(stage);
366 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) 435 if (user_manager::UserManager::Get()->IsCurrentUserOwner())
367 ShowDesktopNotificationAndResetState(state, profile); 436 ShowDesktopNotificationAndResetStage(stage, profile);
368 } 437 }
369 438
370 void ConsumerManagementService::ShowDesktopNotificationAndResetState( 439 void ConsumerManagementService::ShowDesktopNotificationAndResetStage(
371 ConsumerEnrollmentState state, Profile* profile) { 440 EnrollmentStage stage, Profile* profile) {
372 base::string16 title; 441 base::string16 title;
373 base::string16 body; 442 base::string16 body;
374 base::string16 button_label; 443 base::string16 button_label;
375 base::Closure button_click_callback; 444 base::Closure button_click_callback;
376 445
377 if (state == ENROLLMENT_SUCCESS) { 446 if (stage == ENROLLMENT_STAGE_SUCCESS) {
378 title = l10n_util::GetStringUTF16( 447 title = l10n_util::GetStringUTF16(
379 IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_TITLE); 448 IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_TITLE);
380 body = l10n_util::GetStringUTF16( 449 body = l10n_util::GetStringUTF16(
381 IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_BODY); 450 IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_BODY);
382 button_label = l10n_util::GetStringUTF16( 451 button_label = l10n_util::GetStringUTF16(
383 IDS_CONSUMER_MANAGEMENT_NOTIFICATION_MODIFY_SETTINGS_BUTTON); 452 IDS_CONSUMER_MANAGEMENT_NOTIFICATION_MODIFY_SETTINGS_BUTTON);
384 button_click_callback = base::Bind( 453 button_click_callback = base::Bind(
385 &ConsumerManagementService::OpenSettingsPage, 454 &ConsumerManagementService::OpenSettingsPage,
386 weak_ptr_factory_.GetWeakPtr(), 455 weak_ptr_factory_.GetWeakPtr(),
387 profile); 456 profile);
(...skipping 23 matching lines...) Expand all
411 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, 480 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
412 kEnrollmentNotificationId), 481 kEnrollmentNotificationId),
413 base::string16(), // display_source 482 base::string16(), // display_source
414 base::UTF8ToUTF16(kEnrollmentNotificationId), 483 base::UTF8ToUTF16(kEnrollmentNotificationId),
415 optional_field, 484 optional_field,
416 new DesktopNotificationDelegate(kEnrollmentNotificationId, 485 new DesktopNotificationDelegate(kEnrollmentNotificationId,
417 button_click_callback)); 486 button_click_callback));
418 notification.SetSystemPriority(); 487 notification.SetSystemPriority();
419 g_browser_process->notification_ui_manager()->Add(notification, profile); 488 g_browser_process->notification_ui_manager()->Add(notification, profile);
420 489
421 SetEnrollmentState(ENROLLMENT_NONE); 490 SetEnrollmentStage(ENROLLMENT_STAGE_NONE);
422 } 491 }
423 492
424 void ConsumerManagementService::OpenSettingsPage(Profile* profile) const { 493 void ConsumerManagementService::OpenSettingsPage(Profile* profile) const {
425 const GURL url(chrome::kChromeUISettingsURL); 494 const GURL url(chrome::kChromeUISettingsURL);
426 chrome::NavigateParams params(profile, url, content::PAGE_TRANSITION_LINK); 495 chrome::NavigateParams params(profile, url, content::PAGE_TRANSITION_LINK);
427 params.disposition = NEW_FOREGROUND_TAB; 496 params.disposition = NEW_FOREGROUND_TAB;
428 chrome::Navigate(&params); 497 chrome::Navigate(&params);
429 } 498 }
430 499
431 void ConsumerManagementService::TryEnrollmentAgain(Profile* profile) const { 500 void ConsumerManagementService::TryEnrollmentAgain(Profile* profile) const {
432 GURL base_url(chrome::kChromeUISettingsURL); 501 GURL base_url(chrome::kChromeUISettingsURL);
433 GURL url = base_url.Resolve(kConsumerManagementOverlay); 502 GURL url = base_url.Resolve(kConsumerManagementOverlay);
434 503
435 chrome::NavigateParams params(profile, url, content::PAGE_TRANSITION_LINK); 504 chrome::NavigateParams params(profile, url, content::PAGE_TRANSITION_LINK);
436 params.disposition = NEW_FOREGROUND_TAB; 505 params.disposition = NEW_FOREGROUND_TAB;
437 chrome::Navigate(&params); 506 chrome::Navigate(&params);
438 } 507 }
439 508
440 const std::string& ConsumerManagementService::GetAccountIdFromProfile( 509 const std::string& ConsumerManagementService::GetAccountIdFromProfile(
441 Profile* profile) const { 510 Profile* profile) const {
442 return SigninManagerFactory::GetForProfile(profile)-> 511 return SigninManagerFactory::GetForProfile(profile)->
443 GetAuthenticatedAccountId(); 512 GetAuthenticatedAccountId();
444 } 513 }
445 514
515 void ConsumerManagementService::NotifyStatusChanged() {
516 Status status = GetStatus();
517
518 FOR_EACH_OBSERVER(Observer,
519 observers_,
520 OnConsumerManagementStatusChanged(status));
521 }
522
446 } // namespace policy 523 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698