diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 22:49:14 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 22:49:14 +0000 |
commit | 89d9b38895a1cf9a9205683118da437c72c274d1 (patch) | |
tree | 3504c2b17d82dc3efe3e0cbcbb1692b06fc0ec77 | |
parent | b207f138e3d77069754507e7b037451f92570266 (diff) | |
download | chromium_src-89d9b38895a1cf9a9205683118da437c72c274d1.zip chromium_src-89d9b38895a1cf9a9205683118da437c72c274d1.tar.gz chromium_src-89d9b38895a1cf9a9205683118da437c72c274d1.tar.bz2 |
Revert 210422 "This CL adds logic to record some events about a ..."
Speculative revert for failing unit_tests:
[ RUN ] PageCyclerTest.FailProvisionalLoads
Received signal 11 <unknown> 000000000000
[0x7fb1ee68fd7e] base::debug::StackTrace::StackTrace()
[0x7fb1ee68f8b7] base::debug::(anonymous namespace)::StackDumpSignalHandler()
[0x7fb1df7dbcb0] <unknown>
[0x0000037db713] BrowserList::AddBrowser()
[0x0000037bf0ef] Browser::Browser()
[0x000001d9a7bf] BrowserWithTestWindowTest::SetUp()
[0x000000fc8838] PageCyclerTest::SetUp()
[0x0000037763b3] testing::internal::HandleSehExceptionsInMethodIfSupported<>()
[0x00000376d27e] testing::internal::HandleExceptionsInMethodIfSupported<>()
[0x000003764d73] testing::Test::Run()
[0x0000037654cb] testing::TestInfo::Run()
[0x000003765a67] testing::TestCase::Run()
[0x000003769d95] testing::internal::UnitTestImpl::RunAllTests()
[0x000003773473] testing::internal::HandleSehExceptionsInMethodIfSupported<>()
[0x00000376e72e] testing::internal::HandleExceptionsInMethodIfSupported<>()
[0x000003769a84] testing::UnitTest::Run()
[0x000004536baf] base::TestSuite::Run()
[0x0000043e292d] content::UnitTestTestSuite::Run()
[0x0000041bec64] main
[0x7fb1dd40876d] __libc_start_main
[0x0000004fe659] <unknown>
r8: 00007fff4ce909c0 r9: 00007fff4ce909a0 r10: 00007fff4ce90a40 r11: 0000000000000246
r12: 000016465163bfb0 r13: 0000000000000000 r14: 0000000006315e30 r15: 0000000006315be8
di: 0000000000000000 si: 0000164655cbe6b0 bp: 00007fff4ce91070 bx: 0000000006315e68
dx: 0000000000000001 ax: 0000164655ff6360 cx: 3636363636363636 sp: 00007fff4ce90e70
ip: 00000000037db713 efl: 0000000000010206 cgf: 0000000000000033 erf: 0000000000000000
trp: 000000000000000d msk: 0000000000000000 cr2: 0000000000000000
> This CL adds logic to record some events about a managed user that may be useful to the custodian.
>
> These events are:
> 1- Opening of a managed user profile.
> 2- Switching from a managed user profile to any other profile.
> 3- Quitting the browser.
>
>
> BUG=None
>
> Review URL: https://chromiumcodereview.appspot.com/18023017
TBR=ibraaaa@google.com
Review URL: https://codereview.chromium.org/18856008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210435 0039d316-1c4b-4281-b951-d872f2087c98
-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_; |