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

Side by Side Diff: chrome/browser/profile_impl.cc

Issue 5174006: Move DeviceManagementPolicyProvider into the profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address thakis' comments. Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/profile_impl.h" 5 #include "chrome/browser/profile_impl.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/browser/host_content_settings_map.h" 47 #include "chrome/browser/host_content_settings_map.h"
48 #include "chrome/browser/host_zoom_map.h" 48 #include "chrome/browser/host_zoom_map.h"
49 #include "chrome/browser/instant/instant_controller.h" 49 #include "chrome/browser/instant/instant_controller.h"
50 #include "chrome/browser/in_process_webkit/webkit_context.h" 50 #include "chrome/browser/in_process_webkit/webkit_context.h"
51 #include "chrome/browser/net/chrome_url_request_context.h" 51 #include "chrome/browser/net/chrome_url_request_context.h"
52 #include "chrome/browser/net/gaia/token_service.h" 52 #include "chrome/browser/net/gaia/token_service.h"
53 #include "chrome/browser/net/net_pref_observer.h" 53 #include "chrome/browser/net/net_pref_observer.h"
54 #include "chrome/browser/net/ssl_config_service_manager.h" 54 #include "chrome/browser/net/ssl_config_service_manager.h"
55 #include "chrome/browser/notifications/desktop_notification_service.h" 55 #include "chrome/browser/notifications/desktop_notification_service.h"
56 #include "chrome/browser/password_manager/password_store_default.h" 56 #include "chrome/browser/password_manager/password_store_default.h"
57 #include "chrome/browser/policy/configuration_policy_provider.h"
58 #include "chrome/browser/policy/configuration_policy_pref_store.h"
59 #include "chrome/browser/policy/device_management_backend_impl.h"
60 #include "chrome/browser/policy/device_management_policy_provider.h"
57 #include "chrome/browser/prefs/browser_prefs.h" 61 #include "chrome/browser/prefs/browser_prefs.h"
58 #include "chrome/browser/prefs/pref_value_store.h" 62 #include "chrome/browser/prefs/pref_value_store.h"
59 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 63 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
60 #include "chrome/browser/profile_manager.h" 64 #include "chrome/browser/profile_manager.h"
61 #include "chrome/browser/renderer_host/render_process_host.h" 65 #include "chrome/browser/renderer_host/render_process_host.h"
62 #include "chrome/browser/search_engines/template_url_fetcher.h" 66 #include "chrome/browser/search_engines/template_url_fetcher.h"
63 #include "chrome/browser/search_engines/template_url_model.h" 67 #include "chrome/browser/search_engines/template_url_model.h"
64 #include "chrome/browser/sessions/session_service.h" 68 #include "chrome/browser/sessions/session_service.h"
65 #include "chrome/browser/sessions/tab_restore_service.h" 69 #include "chrome/browser/sessions/tab_restore_service.h"
66 #include "chrome/browser/spellcheck_host.h" 70 #include "chrome/browser/spellcheck_host.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 507
504 // The theme provider provides bitmaps to whoever wants them. 508 // The theme provider provides bitmaps to whoever wants them.
505 theme_provider_.reset(); 509 theme_provider_.reset();
506 510
507 // Remove pref observers 511 // Remove pref observers
508 pref_change_registrar_.RemoveAll(); 512 pref_change_registrar_.RemoveAll();
509 513
510 // Delete the NTP resource cache so we can unregister pref observers. 514 // Delete the NTP resource cache so we can unregister pref observers.
511 ntp_resource_cache_.reset(); 515 ntp_resource_cache_.reset();
512 516
517 // Shut down the DM policy provider before the token service dies.
518 if (device_management_policy_provider_.get())
519 device_management_policy_provider_->Shutdown();
520
513 // The sync service needs to be deleted before the services it calls. 521 // The sync service needs to be deleted before the services it calls.
514 sync_service_.reset(); 522 sync_service_.reset();
515 523
516 // Both HistoryService and WebDataService maintain threads for background 524 // Both HistoryService and WebDataService maintain threads for background
517 // processing. Its possible each thread still has tasks on it that have 525 // processing. Its possible each thread still has tasks on it that have
518 // increased the ref count of the service. In such a situation, when we 526 // increased the ref count of the service. In such a situation, when we
519 // decrement the refcount, it won't be 0, and the threads/databases aren't 527 // decrement the refcount, it won't be 0, and the threads/databases aren't
520 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the 528 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the
521 // databases are properly closed. 529 // databases are properly closed.
522 if (web_data_service_.get()) 530 if (web_data_service_.get())
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 NewRunnableMethod(blob_storage_context_.get(), 1312 NewRunnableMethod(blob_storage_context_.get(),
1305 &ChromeBlobStorageContext::InitializeOnIOThread)); 1313 &ChromeBlobStorageContext::InitializeOnIOThread));
1306 } 1314 }
1307 return blob_storage_context_; 1315 return blob_storage_context_;
1308 } 1316 }
1309 1317
1310 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { 1318 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() {
1311 return extension_info_map_.get(); 1319 return extension_info_map_.get();
1312 } 1320 }
1313 1321
1322 policy::DeviceManagementPolicyProvider*
1323 ProfileImpl::GetDeviceManagementPolicyProvider() {
1324 if (!device_management_policy_provider_.get()) {
1325 CommandLine* command_line = CommandLine::ForCurrentProcess();
1326 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) {
1327 device_management_policy_provider_.reset(
1328 new policy::DeviceManagementPolicyProvider(
1329 policy::ConfigurationPolicyPrefStore::
1330 GetChromePolicyDefinitionList(),
1331 new policy::DeviceManagementBackendImpl(
1332 command_line->GetSwitchValueASCII(
1333 switches::kDeviceManagementUrl)),
1334 GetTokenService(),
1335 GetPath()));
1336 }
1337 }
Nico 2010/11/18 14:34:24 I like early exits, they lead to less "indenty" co
Mattias Nissler (ping if slow) 2010/11/18 15:08:16 Yay, me too! But there are many people who don't.
1338 return device_management_policy_provider_.get();
1339 }
1340
1314 PromoCounter* ProfileImpl::GetInstantPromoCounter() { 1341 PromoCounter* ProfileImpl::GetInstantPromoCounter() {
1315 #if defined(OS_WIN) 1342 #if defined(OS_WIN)
1316 // TODO: enable this when we're ready to turn on the promo. 1343 // TODO: enable this when we're ready to turn on the promo.
1317 /* 1344 /*
1318 if (!checked_instant_promo_) { 1345 if (!checked_instant_promo_) {
1319 checked_instant_promo_ = true; 1346 checked_instant_promo_ = true;
1320 PrefService* prefs = GetPrefs(); 1347 PrefService* prefs = GetPrefs();
1321 if (!prefs->GetBoolean(prefs::kInstantEnabledOnce) && 1348 if (!prefs->GetBoolean(prefs::kInstantEnabledOnce) &&
1322 !InstantController::IsEnabled(this) && 1349 !InstantController::IsEnabled(this) &&
1323 InstallUtil::IsChromeSxSProcess()) { 1350 InstallUtil::IsChromeSxSProcess()) {
(...skipping 12 matching lines...) Expand all
1336 #if defined(OS_CHROMEOS) 1363 #if defined(OS_CHROMEOS)
1337 chromeos::ProxyConfigServiceImpl* 1364 chromeos::ProxyConfigServiceImpl*
1338 ProfileImpl::GetChromeOSProxyConfigServiceImpl() { 1365 ProfileImpl::GetChromeOSProxyConfigServiceImpl() {
1339 if (!chromeos_proxy_config_service_impl_) { 1366 if (!chromeos_proxy_config_service_impl_) {
1340 chromeos_proxy_config_service_impl_ = 1367 chromeos_proxy_config_service_impl_ =
1341 new chromeos::ProxyConfigServiceImpl(); 1368 new chromeos::ProxyConfigServiceImpl();
1342 } 1369 }
1343 return chromeos_proxy_config_service_impl_; 1370 return chromeos_proxy_config_service_impl_;
1344 } 1371 }
1345 #endif // defined(OS_CHROMEOS) 1372 #endif // defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698