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

Unified Diff: chrome/browser/policy/cloud/user_cloud_policy_invalidator.h

Issue 23592017: Fix policy invalidator lifecycle bugs for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/cloud/user_cloud_policy_invalidator.h
diff --git a/chrome/browser/policy/cloud/user_cloud_policy_invalidator.h b/chrome/browser/policy/cloud/user_cloud_policy_invalidator.h
index 96988c1a63ec42ca27ef8c8248bcd4be4da8bd3e..992ebfdb1fd4c69b1f332058dd37ad3e77f9c92d 100644
--- a/chrome/browser/policy/cloud/user_cloud_policy_invalidator.h
+++ b/chrome/browser/policy/cloud/user_cloud_policy_invalidator.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_INVALIDATOR_H_
#define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_INVALIDATOR_H_
+#include "base/memory/weak_ptr.h"
#include "chrome/browser/policy/cloud/cloud_policy_invalidator.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "content/public/browser/notification_observer.h"
@@ -31,6 +32,8 @@ class UserCloudPolicyInvalidator : public CloudPolicyInvalidator,
Profile* profile,
CloudPolicyManager* policy_manager);
+ virtual ~UserCloudPolicyInvalidator();
+
// BrowserContextKeyedService:
virtual void Shutdown() OVERRIDE;
@@ -40,15 +43,16 @@ class UserCloudPolicyInvalidator : public CloudPolicyInvalidator,
const content::NotificationDetails& details) OVERRIDE;
private:
- // The profile associated with the invalidator.
- Profile* profile_;
-
// The policy manager for the user policy.
CloudPolicyManager* policy_manager_;
// Used to register for notification that profile creation is complete.
content::NotificationRegistrar registrar_;
+ // WeakPtrFactory used to create a reference to this object used by the
+ // policy manager.
+ base::WeakPtrFactory<CloudPolicyInvalidator> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyInvalidator);
};

Powered by Google App Engine
This is Rietveld 408576698