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

Side by Side Diff: chrome/browser/managed_mode/managed_user_service.h

Issue 15715005: Remove passphrase dialog and last parts of elevation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also remove managed_user_passphrase_unittest. Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/prefs/pref_change_registrar.h" 12 #include "base/prefs/pref_change_registrar.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/browser/extensions/management_policy.h" 14 #include "chrome/browser/extensions/management_policy.h"
15 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" 15 #include "chrome/browser/managed_mode/managed_mode_url_filter.h"
16 #include "chrome/browser/ui/webui/managed_user_passphrase_dialog.h"
17 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 16 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
18 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
20 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
21 20
22 class Browser; 21 class Browser;
23 class GoogleServiceAuthError; 22 class GoogleServiceAuthError;
24 class ManagedModeURLFilter; 23 class ManagedModeURLFilter;
25 class ManagedModeSiteList; 24 class ManagedModeSiteList;
26 class ManagedUserRegistrationService; 25 class ManagedUserRegistrationService;
(...skipping 20 matching lines...) Expand all
47 46
48 explicit ManagedUserService(Profile* profile); 47 explicit ManagedUserService(Profile* profile);
49 virtual ~ManagedUserService(); 48 virtual ~ManagedUserService();
50 49
51 bool ProfileIsManaged() const; 50 bool ProfileIsManaged() const;
52 51
53 // Checks whether the given profile is managed without constructing a 52 // Checks whether the given profile is managed without constructing a
54 // ManagedUserService (which could lead to cyclic dependencies). 53 // ManagedUserService (which could lead to cyclic dependencies).
55 static bool ProfileIsManaged(Profile* profile); 54 static bool ProfileIsManaged(Profile* profile);
56 55
57 // Returns the elevation state for specific WebContents.
58 bool IsElevatedForWebContents(const content::WebContents* web_contents) const;
59
60 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); 56 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
61 57
62 // Returns the URL filter for the IO thread, for filtering network requests 58 // Returns the URL filter for the IO thread, for filtering network requests
63 // (in ManagedModeResourceThrottle). 59 // (in ManagedModeResourceThrottle).
64 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); 60 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread();
65 61
66 // Returns the URL filter for the UI thread, for filtering navigations and 62 // Returns the URL filter for the UI thread, for filtering navigations and
67 // classifying sites in the history view. 63 // classifying sites in the history view.
68 ManagedModeURLFilter* GetURLFilterForUIThread(); 64 ManagedModeURLFilter* GetURLFilterForUIThread();
69 65
(...skipping 20 matching lines...) Expand all
90 ManualBehavior GetManualBehaviorForURL(const GURL& url); 86 ManualBehavior GetManualBehaviorForURL(const GURL& url);
91 87
92 // Sets the manual behavior for the given URL. 88 // Sets the manual behavior for the given URL.
93 void SetManualBehaviorForURLs(const std::vector<GURL>& url, 89 void SetManualBehaviorForURLs(const std::vector<GURL>& url,
94 ManualBehavior behavior); 90 ManualBehavior behavior);
95 91
96 // Returns all URLS on the given host that have exceptions. 92 // Returns all URLS on the given host that have exceptions.
97 void GetManualExceptionsForHost(const std::string& host, 93 void GetManualExceptionsForHost(const std::string& host,
98 std::vector<GURL>* urls); 94 std::vector<GURL>* urls);
99 95
100 // Checks if the passphrase dialog can be skipped (the profile is already in
101 // elevated state for the given WebContents or the passphrase is empty).
102 bool CanSkipPassphraseDialog(const content::WebContents* web_contents) const;
103
104 // Handles the request to authorize as the custodian of the managed user.
105 void RequestAuthorization(content::WebContents* web_contents,
106 const PassphraseCheckedCallback& callback);
107
108 // Initializes this object. This method does nothing if the profile is not 96 // Initializes this object. This method does nothing if the profile is not
109 // managed. 97 // managed.
110 void Init(); 98 void Init();
111 99
112 // Marks the profile as managed and initializes it. 100 // Marks the profile as managed and initializes it.
113 void InitForTesting(); 101 void InitForTesting();
114 102
115 // Initializes this profile for syncing, using the provided |token| to 103 // Initializes this profile for syncing, using the provided |token| to
116 // authenticate requests. 104 // authenticate requests.
117 void InitSync(const std::string& token); 105 void InitSync(const std::string& token);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void UpdateSiteLists(); 182 void UpdateSiteLists();
195 183
196 // Updates the manual overrides for hosts in the URL filters when the 184 // Updates the manual overrides for hosts in the URL filters when the
197 // corresponding preference is changed. 185 // corresponding preference is changed.
198 void UpdateManualHosts(); 186 void UpdateManualHosts();
199 187
200 // Updates the manual overrides for URLs in the URL filters when the 188 // Updates the manual overrides for URLs in the URL filters when the
201 // corresponding preference is changed. 189 // corresponding preference is changed.
202 void UpdateManualURLs(); 190 void UpdateManualURLs();
203 191
204 // Returns if the passphrase to authorize as the custodian is empty.
205 bool IsPassphraseEmpty() const;
206
207 base::WeakPtrFactory<ManagedUserService> weak_ptr_factory_; 192 base::WeakPtrFactory<ManagedUserService> weak_ptr_factory_;
208 193
209 // Owns us via the BrowserContextKeyedService mechanism. 194 // Owns us via the BrowserContextKeyedService mechanism.
210 Profile* profile_; 195 Profile* profile_;
211 196
212 content::NotificationRegistrar registrar_; 197 content::NotificationRegistrar registrar_;
213 PrefChangeRegistrar pref_change_registrar_; 198 PrefChangeRegistrar pref_change_registrar_;
214 199
215 // Stores the extension ids of the extensions which currently can be modified
216 // by the managed user.
217 std::set<std::string> elevated_for_extensions_;
218
219 // Sets a profile in elevated state for testing if set to true. 200 // Sets a profile in elevated state for testing if set to true.
220 bool elevated_for_testing_; 201 bool elevated_for_testing_;
221 202
222 URLFilterContext url_filter_context_; 203 URLFilterContext url_filter_context_;
223 }; 204 };
224 205
225 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ 206 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698