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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 353493002: Apps&Extensions for supervised users: Add Extension::WAS_INSTALLED_BY_CUSTODIAN flag and proto entry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/supervised_user/supervised_user_service.h" 5 #include "chrome/browser/supervised_user/supervised_user_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // all existing extensions. 279 // all existing extensions.
280 ExtensionService* extension_service = 280 ExtensionService* extension_service =
281 extensions::ExtensionSystem::Get(profile_)->extension_service(); 281 extensions::ExtensionSystem::Get(profile_)->extension_service();
282 282
283 // |extension_service| can be NULL in a unit test. 283 // |extension_service| can be NULL in a unit test.
284 if (extension_service && 284 if (extension_service &&
285 extension_service->GetInstalledExtension(extension->id())) 285 extension_service->GetInstalledExtension(extension->id()))
286 return true; 286 return true;
287 287
288 bool was_installed_by_default = extension->was_installed_by_default(); 288 bool was_installed_by_default = extension->was_installed_by_default();
289 bool was_installed_by_custodian = extension->was_installed_by_custodian();
289 #if defined(OS_CHROMEOS) 290 #if defined(OS_CHROMEOS)
290 // On Chrome OS all external sources are controlled by us so it means that 291 // On Chrome OS all external sources are controlled by us so it means that
291 // they are "default". Method was_installed_by_default returns false because 292 // they are "default". Method was_installed_by_default returns false because
292 // extensions creation flags are ignored in case of default extensions with 293 // extensions creation flags are ignored in case of default extensions with
293 // update URL(the flags aren't passed to OnExternalExtensionUpdateUrlFound). 294 // update URL(the flags aren't passed to OnExternalExtensionUpdateUrlFound).
294 // TODO(dpolukhin): remove this Chrome OS specific code as soon as creation 295 // TODO(dpolukhin): remove this Chrome OS specific code as soon as creation
295 // flags are not ignored. 296 // flags are not ignored.
296 was_installed_by_default = 297 was_installed_by_default =
297 extensions::Manifest::IsExternalLocation(extension->location()); 298 extensions::Manifest::IsExternalLocation(extension->location());
298 #endif 299 #endif
299 if (extension->location() == extensions::Manifest::COMPONENT || 300 if (extension->location() == extensions::Manifest::COMPONENT ||
300 was_installed_by_default) { 301 was_installed_by_default ||
302 was_installed_by_custodian) {
301 return true; 303 return true;
302 } 304 }
303 305
304 if (error) 306 if (error)
305 *error = tmp_error; 307 *error = tmp_error;
306 return false; 308 return false;
307 } 309 }
308 310
309 bool SupervisedUserService::UserMayModifySettings( 311 bool SupervisedUserService::UserMayModifySettings(
310 const extensions::Extension* extension, 312 const extensions::Extension* extension,
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 765
764 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { 766 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) {
765 bool profile_became_active = profile_->IsSameProfile(browser->profile()); 767 bool profile_became_active = profile_->IsSameProfile(browser->profile());
766 if (!is_profile_active_ && profile_became_active) 768 if (!is_profile_active_ && profile_became_active)
767 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); 769 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile"));
768 else if (is_profile_active_ && !profile_became_active) 770 else if (is_profile_active_ && !profile_became_active)
769 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 771 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
770 772
771 is_profile_active_ = profile_became_active; 773 is_profile_active_ = profile_became_active;
772 } 774 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/pending_extension_manager.cc ('k') | chrome/browser/themes/theme_syncable_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698