OLD | NEW |
1 // Copyright (c) 2011 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/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/net/gaia/token_service.h" | 12 #include "chrome/browser/net/gaia/token_service.h" |
| 13 #include "chrome/browser/policy/cloud_policy_data_store.h" |
13 #include "chrome/browser/policy/cloud_policy_provider.h" | 14 #include "chrome/browser/policy/cloud_policy_provider.h" |
14 #include "chrome/browser/policy/cloud_policy_provider_impl.h" | 15 #include "chrome/browser/policy/cloud_policy_provider_impl.h" |
15 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 16 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
16 #include "chrome/browser/policy/configuration_policy_pref_store.h" | |
17 #include "chrome/browser/policy/configuration_policy_provider.h" | 17 #include "chrome/browser/policy/configuration_policy_provider.h" |
18 #include "chrome/browser/policy/network_configuration_updater.h" | 18 #include "chrome/browser/policy/network_configuration_updater.h" |
19 #include "chrome/browser/policy/user_policy_cache.h" | 19 #include "chrome/browser/policy/user_policy_cache.h" |
20 #include "chrome/browser/policy/user_policy_token_cache.h" | 20 #include "chrome/browser/policy/user_policy_token_cache.h" |
21 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
24 #include "chrome/common/net/gaia/gaia_constants.h" | 24 #include "chrome/common/net/gaia/gaia_constants.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 const CloudPolicyDataStore* | 336 const CloudPolicyDataStore* |
337 BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { | 337 BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { |
338 return user_data_store_.get(); | 338 return user_data_store_.get(); |
339 } | 339 } |
340 | 340 |
341 const ConfigurationPolicyHandlerList* | 341 const ConfigurationPolicyHandlerList* |
342 BrowserPolicyConnector::GetHandlerList() const { | 342 BrowserPolicyConnector::GetHandlerList() const { |
343 return &handler_list_; | 343 return &handler_list_; |
344 } | 344 } |
345 | 345 |
346 CloudPolicyDataStore::UserAffiliation | 346 UserAffiliation BrowserPolicyConnector::GetUserAffiliation( |
347 BrowserPolicyConnector::GetUserAffiliation(const std::string& user_name) { | 347 const std::string& user_name) { |
348 #if defined(OS_CHROMEOS) | 348 #if defined(OS_CHROMEOS) |
349 if (install_attributes_.get()) { | 349 if (install_attributes_.get()) { |
350 size_t pos = user_name.find('@'); | 350 size_t pos = user_name.find('@'); |
351 if (pos != std::string::npos && | 351 if (pos != std::string::npos && |
352 user_name.substr(pos + 1) == install_attributes_->GetDomain()) { | 352 user_name.substr(pos + 1) == install_attributes_->GetDomain()) { |
353 return CloudPolicyDataStore::USER_AFFILIATION_MANAGED; | 353 return USER_AFFILIATION_MANAGED; |
354 } | 354 } |
355 } | 355 } |
356 #endif | 356 #endif |
357 | 357 |
358 return CloudPolicyDataStore::USER_AFFILIATION_NONE; | 358 return USER_AFFILIATION_NONE; |
359 } | 359 } |
360 | 360 |
361 void BrowserPolicyConnector::Observe( | 361 void BrowserPolicyConnector::Observe( |
362 int type, | 362 int type, |
363 const content::NotificationSource& source, | 363 const content::NotificationSource& source, |
364 const content::NotificationDetails& details) { | 364 const content::NotificationDetails& details) { |
365 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 365 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
366 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { | 366 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { |
367 const TokenService* token_source = | 367 const TokenService* token_source = |
368 content::Source<const TokenService>(source).ptr(); | 368 content::Source<const TokenService>(source).ptr(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); | 485 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); |
486 } else { | 486 } else { |
487 return NULL; | 487 return NULL; |
488 } | 488 } |
489 #else | 489 #else |
490 return NULL; | 490 return NULL; |
491 #endif | 491 #endif |
492 } | 492 } |
493 | 493 |
494 } // namespace policy | 494 } // namespace policy |
OLD | NEW |