diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/managed_mode/managed_user_service.cc | 44 | ||||
-rw-r--r-- | chrome/browser/managed_mode/managed_user_service.h | 13 |
2 files changed, 2 insertions, 55 deletions
diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc index eeb0083..4f46157 100644 --- a/chrome/browser/managed_mode/managed_user_service.cc +++ b/chrome/browser/managed_mode/managed_user_service.cc @@ -9,7 +9,6 @@ #include "base/metrics/field_trial.h" #include "base/prefs/pref_service.h" #include "base/sequenced_task_runner.h" -#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" @@ -30,7 +29,6 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" @@ -61,11 +59,6 @@ const char kManagedUserAccessRequestKeyPrefix[] = "X-ManagedUser-AccessRequests"; const char kManagedUserAccessRequestTime[] = "timestamp"; const char kManagedUserPseudoEmail[] = "managed_user@localhost"; -const char kOpenManagedProfileKeyPrefix[] = "X-ManagedUser-Events-OpenProfile"; -const char kQuitBrowserKeyPrefix[] = "X-ManagedUser-Events-QuitBrowser"; -const char kSwitchFromManagedProfileKeyPrefix[] = - "X-ManagedUser-Events-SwitchProfile"; -const char kEventTimestamp[] = "timestamp"; std::string CanonicalizeHostname(const std::string& hostname) { std::string canonicalized; @@ -147,19 +140,12 @@ ManagedUserService::ManagedUserService(Profile* profile) : weak_ptr_factory_(this), profile_(profile), waiting_for_sync_initialization_(false), - is_profile_active_(false), elevated_for_testing_(false) { } -ManagedUserService::~ManagedUserService() { -} +ManagedUserService::~ManagedUserService() {} void ManagedUserService::Shutdown() { - if (ProfileIsManaged()) { - RecordProfileAndBrowserEventsHelper(kQuitBrowserKeyPrefix); - BrowserList::RemoveObserver(this); - } - if (!waiting_for_sync_initialization_) return; @@ -548,8 +534,6 @@ void ManagedUserService::Init() { base::Bind(&ManagedUserService::UpdateManualURLs, base::Unretained(this))); - BrowserList::AddObserver(this); - if (policy_provider) policy_provider->InitLocalPolicies(); @@ -635,29 +619,3 @@ void ManagedUserService::UpdateManualURLs() { } url_filter_context_.SetManualURLs(url_map.Pass()); } - -void ManagedUserService::OnBrowserSetLastActive(Browser* browser) { - bool profile_became_active = profile_->IsSameProfile(browser->profile()); - if (!is_profile_active_ && profile_became_active) - RecordProfileAndBrowserEventsHelper(kOpenManagedProfileKeyPrefix); - else if (is_profile_active_ && !profile_became_active) - RecordProfileAndBrowserEventsHelper(kSwitchFromManagedProfileKeyPrefix); - - is_profile_active_ = profile_became_active; -} - -void ManagedUserService::RecordProfileAndBrowserEventsHelper( - const char* key_prefix) { - std::string key = ManagedModePolicyProvider::MakeSplitSettingKey(key_prefix, - base::Int64ToString(base::TimeTicks::Now().ToInternalValue())); - - scoped_ptr<DictionaryValue> dict(new DictionaryValue); - - // TODO(bauerb): Use sane time when ready. - dict->SetDouble(kEventTimestamp, base::Time::Now().ToJsTime()); - - ManagedModePolicyProvider* provider = GetPolicyProvider(); - // It is NULL in tests. - if (provider) - provider->UploadItem(key, dict.PassAs<Value>()); -} diff --git a/chrome/browser/managed_mode/managed_user_service.h b/chrome/browser/managed_mode/managed_user_service.h index 125dc42..3bcc321 100644 --- a/chrome/browser/managed_mode/managed_user_service.h +++ b/chrome/browser/managed_mode/managed_user_service.h @@ -41,8 +41,7 @@ class PrefRegistrySyncable; class ManagedUserService : public BrowserContextKeyedService, public extensions::ManagementPolicy::Provider, public ProfileSyncServiceObserver, - public content::NotificationObserver, - public chrome::BrowserListObserver { + public content::NotificationObserver { public: typedef std::vector<string16> CategoryList; @@ -157,9 +156,6 @@ class ManagedUserService : public BrowserContextKeyedService, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // chrome::BrowserListObserver implementation: - virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; - private: friend class ManagedUserServiceExtensionTest; @@ -226,12 +222,6 @@ class ManagedUserService : public BrowserContextKeyedService, // corresponding preference is changed. void UpdateManualURLs(); - // Records some events (opening the managed user profile, switching from the - // managed user profile, and quitting the browser); each is stored - // using a key with a prefix (|key_prefix|) indicating the type of the event. - // Each entry is a dictionary which has the timestamp of the event. - void RecordProfileAndBrowserEventsHelper(const char* key_prefix); - base::WeakPtrFactory<ManagedUserService> weak_ptr_factory_; // Owns us via the BrowserContextKeyedService mechanism. @@ -242,7 +232,6 @@ class ManagedUserService : public BrowserContextKeyedService, // True iff we're waiting for the Sync service to be initialized. bool waiting_for_sync_initialization_; - bool is_profile_active_; // Sets a profile in elevated state for testing if set to true. bool elevated_for_testing_; |