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

Side by Side Diff: chrome/browser/component_updater/supervised_user_whitelist_installer.cc

Issue 879993005: Add support for uninstalling components and use it in SupervisedUserWhitelistInstaller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: cleanup Created 5 years, 10 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
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/component_updater/supervised_user_whitelist_installer.h " 5 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h "
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 public: 114 public:
115 explicit SupervisedUserWhitelistInstallerImpl(ComponentUpdateService* cus); 115 explicit SupervisedUserWhitelistInstallerImpl(ComponentUpdateService* cus);
116 ~SupervisedUserWhitelistInstallerImpl() override {} 116 ~SupervisedUserWhitelistInstallerImpl() override {}
117 117
118 private: 118 private:
119 // SupervisedUserWhitelistInstaller overrides: 119 // SupervisedUserWhitelistInstaller overrides:
120 void RegisterWhitelist(const std::string& crx_id, 120 void RegisterWhitelist(const std::string& crx_id,
121 const std::string& name, 121 const std::string& name,
122 bool newly_added, 122 bool newly_added,
123 const WhitelistReadyCallback& callback) override; 123 const WhitelistReadyCallback& callback) override;
124 void UnregisterWhitelist(const std::string& crx_id) override; 124 void UninstallWhitelist(const std::string& crx_id) override;
125 125
126 ComponentUpdateService* cus_; 126 ComponentUpdateService* cus_;
127 }; 127 };
128 128
129 SupervisedUserWhitelistInstallerImpl::SupervisedUserWhitelistInstallerImpl( 129 SupervisedUserWhitelistInstallerImpl::SupervisedUserWhitelistInstallerImpl(
130 ComponentUpdateService* cus) 130 ComponentUpdateService* cus)
131 : cus_(cus) { 131 : cus_(cus) {
132 } 132 }
133 133
134 void SupervisedUserWhitelistInstallerImpl::RegisterWhitelist( 134 void SupervisedUserWhitelistInstallerImpl::RegisterWhitelist(
135 const std::string& crx_id, 135 const std::string& crx_id,
136 const std::string& name, 136 const std::string& name,
137 bool newly_added, 137 bool newly_added,
138 const WhitelistReadyCallback& callback) { 138 const WhitelistReadyCallback& callback) {
139 scoped_ptr<ComponentInstallerTraits> traits( 139 scoped_ptr<ComponentInstallerTraits> traits(
140 new SupervisedUserWhitelistComponentInstallerTraits(crx_id, name, 140 new SupervisedUserWhitelistComponentInstallerTraits(crx_id, name,
141 callback)); 141 callback));
142 scoped_refptr<DefaultComponentInstaller> installer( 142 scoped_refptr<DefaultComponentInstaller> installer(
143 new DefaultComponentInstaller(traits.Pass())); 143 new DefaultComponentInstaller(traits.Pass()));
144
145 installer->Register(cus_); 144 installer->Register(cus_);
146 145
147 if (newly_added) 146 if (newly_added)
148 TriggerComponentUpdate(&cus_->GetOnDemandUpdater(), crx_id); 147 TriggerComponentUpdate(&cus_->GetOnDemandUpdater(), crx_id);
149 } 148 }
150 149
151 void SupervisedUserWhitelistInstallerImpl::UnregisterWhitelist( 150 void SupervisedUserWhitelistInstallerImpl::UninstallWhitelist(
152 const std::string& id) { 151 const std::string& crx_id) {
153 // TODO(bauerb): Implement! 152 ComponentUpdateService::Status status = cus_->UnregisterComponent(crx_id);
Sorin Jianu 2015/02/06 19:11:58 can be const
Bernhard Bauer 2015/02/06 22:49:03 Done.
154 NOTIMPLEMENTED(); 153 DCHECK_EQ(ComponentUpdateService::kOk, status);
155 } 154 }
156 155
157 } // namespace 156 } // namespace
158 157
159 // static 158 // static
160 scoped_ptr<SupervisedUserWhitelistInstaller> 159 scoped_ptr<SupervisedUserWhitelistInstaller>
161 SupervisedUserWhitelistInstaller::Create(ComponentUpdateService* cus) { 160 SupervisedUserWhitelistInstaller::Create(ComponentUpdateService* cus) {
162 return make_scoped_ptr(new SupervisedUserWhitelistInstallerImpl(cus)); 161 return make_scoped_ptr(new SupervisedUserWhitelistInstallerImpl(cus));
163 } 162 }
164 163
(...skipping 20 matching lines...) Expand all
185 } 184 }
186 185
187 // static 186 // static
188 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate( 187 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate(
189 OnDemandUpdater* updater, 188 OnDemandUpdater* updater,
190 const std::string& crx_id) { 189 const std::string& crx_id) {
191 updater->OnDemandUpdate(crx_id); 190 updater->OnDemandUpdate(crx_id);
192 } 191 }
193 192
194 } // namespace component_updater 193 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698