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

Side by Side Diff: chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h

Issue 52343002: policy: Register OffTheRecordProfile at UserCloudPolicyManagerFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 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
« no previous file with comments | « no previous file | chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Returns the UserCloudPolicyManager instance associated with |profile|. 44 // Returns the UserCloudPolicyManager instance associated with |profile|.
45 static UserCloudPolicyManager* GetForProfile(Profile* profile); 45 static UserCloudPolicyManager* GetForProfile(Profile* profile);
46 46
47 // Creates an instance for |profile|. Note that the caller is responsible for 47 // Creates an instance for |profile|. Note that the caller is responsible for
48 // managing the lifetime of the instance. Subsequent calls to GetForProfile() 48 // managing the lifetime of the instance. Subsequent calls to GetForProfile()
49 // will return the created instance as long as it lives. 49 // will return the created instance as long as it lives.
50 // 50 //
51 // If |force_immediate_load| is true, policy is loaded synchronously from 51 // If |force_immediate_load| is true, policy is loaded synchronously from
52 // UserCloudPolicyStore at startup. 52 // UserCloudPolicyStore at startup.
53 static scoped_ptr<UserCloudPolicyManager> CreateForProfile( 53 static scoped_ptr<UserCloudPolicyManager> CreateForOriginalProfile(
54 Profile* profile, 54 Profile* profile,
55 bool force_immediate_load, 55 bool force_immediate_load,
56 scoped_refptr<base::SequencedTaskRunner> background_task_runner); 56 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
57 57
58 static UserCloudPolicyManager* RegisterForOffTheRecordProfile(
59 Profile* original_profile,
60 Profile* off_the_record_profile);
61
58 private: 62 private:
59 friend class UserCloudPolicyManager; 63 friend class UserCloudPolicyManager;
60 friend struct DefaultSingletonTraits<UserCloudPolicyManagerFactory>; 64 friend struct DefaultSingletonTraits<UserCloudPolicyManagerFactory>;
61 65
62 UserCloudPolicyManagerFactory(); 66 UserCloudPolicyManagerFactory();
63 virtual ~UserCloudPolicyManagerFactory(); 67 virtual ~UserCloudPolicyManagerFactory();
64 68
65 // See comments for the static versions above. 69 // See comments for the static versions above.
66 UserCloudPolicyManager* GetManagerForProfile(Profile* profile); 70 UserCloudPolicyManager* GetManagerForProfile(Profile* profile);
67 scoped_ptr<UserCloudPolicyManager> CreateManagerForProfile( 71
72 scoped_ptr<UserCloudPolicyManager> CreateManagerForOriginalProfile(
68 Profile* profile, 73 Profile* profile,
69 bool force_immediate_load, 74 bool force_immediate_load,
70 scoped_refptr<base::SequencedTaskRunner> background_task_runner); 75 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
71 76
77 UserCloudPolicyManager* RegisterManagerForOffTheRecordProfile(
78 Profile* original_profile,
79 Profile* off_the_record_profile);
80
72 // BrowserContextKeyedBaseFactory: 81 // BrowserContextKeyedBaseFactory:
73 virtual void BrowserContextShutdown( 82 virtual void BrowserContextShutdown(
74 content::BrowserContext* profile) OVERRIDE; 83 content::BrowserContext* context) OVERRIDE;
75 virtual void SetEmptyTestingFactory( 84 virtual void SetEmptyTestingFactory(
76 content::BrowserContext* profile) OVERRIDE; 85 content::BrowserContext* context) OVERRIDE;
77 virtual void CreateServiceNow(content::BrowserContext* profile) OVERRIDE; 86 virtual void CreateServiceNow(content::BrowserContext* context) OVERRIDE;
78 87
79 // Invoked by UserCloudPolicyManager to register/unregister instances. 88 // Invoked by UserCloudPolicyManager to register/unregister instances.
80 void Register(Profile* profile, UserCloudPolicyManager* instance); 89 void Register(Profile* profile, UserCloudPolicyManager* instance);
81 void Unregister(Profile* profile, UserCloudPolicyManager* instance); 90 void Unregister(Profile* profile, UserCloudPolicyManager* instance);
82 91
83 typedef std::map<Profile*, UserCloudPolicyManager*> ManagerMap; 92 typedef std::map<Profile*, UserCloudPolicyManager*> ManagerMap;
93
84 ManagerMap managers_; 94 ManagerMap managers_;
85 95
86 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactory); 96 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactory);
87 }; 97 };
88 98
89 } // namespace policy 99 } // namespace policy
90 100
91 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ 101 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698