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

Side by Side Diff: chrome/browser/extensions/pending_extension_manager.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/extensions/pending_extension_manager.h" 5 #include "chrome/browser/extensions/pending_extension_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/version.h" 10 #include "base/version.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 return false; 85 return false;
86 } 86 }
87 87
88 bool PendingExtensionManager::AddFromSync( 88 bool PendingExtensionManager::AddFromSync(
89 const std::string& id, 89 const std::string& id,
90 const GURL& update_url, 90 const GURL& update_url,
91 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, 91 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install,
92 bool install_silently, 92 bool install_silently,
93 bool remote_install) { 93 bool remote_install,
94 bool installed_by_custodian) {
94 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 95 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
95 96
96 if (ExtensionRegistry::Get(context_)->GetExtensionById( 97 if (ExtensionRegistry::Get(context_)->GetExtensionById(
97 id, ExtensionRegistry::EVERYTHING)) { 98 id, ExtensionRegistry::EVERYTHING)) {
98 LOG(ERROR) << "Trying to add pending extension " << id 99 LOG(ERROR) << "Trying to add pending extension " << id
99 << " which already exists"; 100 << " which already exists";
100 return false; 101 return false;
101 } 102 }
102 103
103 // Make sure we don't ever try to install the CWS app, because even though 104 // Make sure we don't ever try to install the CWS app, because even though
104 // it is listed as a syncable app (because its values need to be synced) it 105 // it is listed as a syncable app (because its values need to be synced) it
105 // should already be installed on every instance. 106 // should already be installed on every instance.
106 if (id == extension_misc::kWebStoreAppId) { 107 if (id == extension_misc::kWebStoreAppId) {
107 NOTREACHED(); 108 NOTREACHED();
108 return false; 109 return false;
109 } 110 }
110 111
112 int creation_flags = Extension::NO_FLAGS;
113 if (installed_by_custodian) {
114 creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN;
115 }
116
111 static const bool kIsFromSync = true; 117 static const bool kIsFromSync = true;
112 static const Manifest::Location kSyncLocation = Manifest::INTERNAL; 118 static const Manifest::Location kSyncLocation = Manifest::INTERNAL;
113 static const bool kMarkAcknowledged = false; 119 static const bool kMarkAcknowledged = false;
114 120
115 return AddExtensionImpl(id, 121 return AddExtensionImpl(id,
116 std::string(), 122 std::string(),
117 update_url, 123 update_url,
118 Version(), 124 Version(),
119 should_allow_install, 125 should_allow_install,
120 kIsFromSync, 126 kIsFromSync,
121 install_silently, 127 install_silently,
122 kSyncLocation, 128 kSyncLocation,
123 Extension::NO_FLAGS, 129 creation_flags,
124 kMarkAcknowledged, 130 kMarkAcknowledged,
125 remote_install); 131 remote_install);
126 } 132 }
127 133
128 bool PendingExtensionManager::AddFromExtensionImport( 134 bool PendingExtensionManager::AddFromExtensionImport(
129 const std::string& id, 135 const std::string& id,
130 const GURL& update_url, 136 const GURL& update_url,
131 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install) { 137 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install) {
132 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 138 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
133 139
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 314
309 return true; 315 return true;
310 } 316 }
311 317
312 void PendingExtensionManager::AddForTesting( 318 void PendingExtensionManager::AddForTesting(
313 const PendingExtensionInfo& pending_extension_info) { 319 const PendingExtensionInfo& pending_extension_info) {
314 pending_extension_list_.push_back(pending_extension_info); 320 pending_extension_list_.push_back(pending_extension_info);
315 } 321 }
316 322
317 } // namespace extensions 323 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/pending_extension_manager.h ('k') | chrome/browser/supervised_user/supervised_user_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698