OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/managed_mode/managed_user_service.h" | 5 #include "chrome/browser/managed_mode/managed_user_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 | 144 |
145 ManagedUserService::~ManagedUserService() { | 145 ManagedUserService::~ManagedUserService() { |
146 DCHECK(did_shutdown_); | 146 DCHECK(did_shutdown_); |
147 } | 147 } |
148 | 148 |
149 void ManagedUserService::Shutdown() { | 149 void ManagedUserService::Shutdown() { |
150 did_shutdown_ = true; | 150 did_shutdown_ = true; |
151 if (ProfileIsManaged()) { | 151 if (ProfileIsManaged()) { |
152 RecordProfileAndBrowserEventsHelper(kQuitBrowserKeyPrefix); | 152 RecordProfileAndBrowserEventsHelper(kQuitBrowserKeyPrefix); |
| 153 #if !defined(OS_ANDROID) |
| 154 // TODO(bauerb): Get rid of the platform-specific #ifdef here. |
| 155 // http://crbug.com/313377 |
153 BrowserList::RemoveObserver(this); | 156 BrowserList::RemoveObserver(this); |
| 157 #endif |
154 } | 158 } |
155 | 159 |
156 if (!waiting_for_sync_initialization_) | 160 if (!waiting_for_sync_initialization_) |
157 return; | 161 return; |
158 | 162 |
159 ProfileSyncService* sync_service = | 163 ProfileSyncService* sync_service = |
160 ProfileSyncServiceFactory::GetForProfile(profile_); | 164 ProfileSyncServiceFactory::GetForProfile(profile_); |
161 sync_service->RemoveObserver(this); | 165 sync_service->RemoveObserver(this); |
162 } | 166 } |
163 | 167 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 prefs::kDefaultManagedModeFilteringBehavior, | 571 prefs::kDefaultManagedModeFilteringBehavior, |
568 base::Bind(&ManagedUserService::OnDefaultFilteringBehaviorChanged, | 572 base::Bind(&ManagedUserService::OnDefaultFilteringBehaviorChanged, |
569 base::Unretained(this))); | 573 base::Unretained(this))); |
570 pref_change_registrar_.Add(prefs::kManagedModeManualHosts, | 574 pref_change_registrar_.Add(prefs::kManagedModeManualHosts, |
571 base::Bind(&ManagedUserService::UpdateManualHosts, | 575 base::Bind(&ManagedUserService::UpdateManualHosts, |
572 base::Unretained(this))); | 576 base::Unretained(this))); |
573 pref_change_registrar_.Add(prefs::kManagedModeManualURLs, | 577 pref_change_registrar_.Add(prefs::kManagedModeManualURLs, |
574 base::Bind(&ManagedUserService::UpdateManualURLs, | 578 base::Bind(&ManagedUserService::UpdateManualURLs, |
575 base::Unretained(this))); | 579 base::Unretained(this))); |
576 | 580 |
| 581 #if !defined(OS_ANDROID) |
| 582 // TODO(bauerb): Get rid of the platform-specific #ifdef here. |
| 583 // http://crbug.com/313377 |
577 BrowserList::AddObserver(this); | 584 BrowserList::AddObserver(this); |
| 585 #endif |
578 | 586 |
579 // Initialize the filter. | 587 // Initialize the filter. |
580 OnDefaultFilteringBehaviorChanged(); | 588 OnDefaultFilteringBehaviorChanged(); |
581 UpdateSiteLists(); | 589 UpdateSiteLists(); |
582 UpdateManualHosts(); | 590 UpdateManualHosts(); |
583 UpdateManualURLs(); | 591 UpdateManualURLs(); |
584 } | 592 } |
585 | 593 |
586 void ManagedUserService::RegisterAndInitSync( | 594 void ManagedUserService::RegisterAndInitSync( |
587 ManagedUserRegistrationUtility* registration_utility, | 595 ManagedUserRegistrationUtility* registration_utility, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 key_prefix, | 688 key_prefix, |
681 base::Int64ToString(base::TimeTicks::Now().ToInternalValue())); | 689 base::Int64ToString(base::TimeTicks::Now().ToInternalValue())); |
682 | 690 |
683 scoped_ptr<DictionaryValue> dict(new DictionaryValue); | 691 scoped_ptr<DictionaryValue> dict(new DictionaryValue); |
684 | 692 |
685 // TODO(bauerb): Use sane time when ready. | 693 // TODO(bauerb): Use sane time when ready. |
686 dict->SetDouble(kEventTimestamp, base::Time::Now().ToJsTime()); | 694 dict->SetDouble(kEventTimestamp, base::Time::Now().ToJsTime()); |
687 | 695 |
688 GetSettingsService()->UploadItem(key, dict.PassAs<Value>()); | 696 GetSettingsService()->UploadItem(key, dict.PassAs<Value>()); |
689 } | 697 } |
OLD | NEW |