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

Side by Side Diff: chrome/browser/extensions/bundle_installer.cc

Issue 1349613003: [Extensions] Un-refcount PermissionSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 (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 #include "chrome/browser/extensions/bundle_installer.h" 5 #include "chrome/browser/extensions/bundle_installer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 ShowPrompt(); 254 ShowPrompt();
255 } 255 }
256 256
257 void BundleInstaller::ShowPrompt() { 257 void BundleInstaller::ShowPrompt() {
258 // Abort if we couldn't create any Extensions out of the manifests. 258 // Abort if we couldn't create any Extensions out of the manifests.
259 if (dummy_extensions_.empty()) { 259 if (dummy_extensions_.empty()) {
260 approval_callback_.Run(APPROVAL_ERROR); 260 approval_callback_.Run(APPROVAL_ERROR);
261 return; 261 return;
262 } 262 }
263 263
264 scoped_refptr<const PermissionSet> permissions = 264 scoped_ptr<const PermissionSet> permissions;
265 dummy_extensions_[0]->permissions_data()->active_permissions(); 265 for (size_t i = 0; i < dummy_extensions_.size(); ++i) {
266 for (size_t i = 1; i < dummy_extensions_.size(); ++i) {
267 permissions = PermissionSet::CreateUnion( 266 permissions = PermissionSet::CreateUnion(
268 *permissions, 267 permissions ? *permissions : PermissionSet(),
269 *dummy_extensions_[i]->permissions_data()->active_permissions()); 268 *dummy_extensions_[i]->permissions_data()->active_permissions());
270 } 269 }
271 270
272 if (g_auto_approve_for_test == PROCEED) { 271 if (g_auto_approve_for_test == PROCEED) {
273 InstallUIProceed(); 272 InstallUIProceed();
274 } else if (g_auto_approve_for_test == ABORT) { 273 } else if (g_auto_approve_for_test == ABORT) {
275 InstallUIAbort(true); 274 InstallUIAbort(true);
276 } else { 275 } else {
277 Browser* browser = browser_; 276 Browser* browser = browser_;
278 if (!browser) { 277 if (!browser) {
279 // The browser that we got initially could have gone away during our 278 // The browser that we got initially could have gone away during our
280 // thread hopping. 279 // thread hopping.
281 browser = chrome::FindLastActiveWithProfile(profile_, host_desktop_type_); 280 browser = chrome::FindLastActiveWithProfile(profile_, host_desktop_type_);
282 } 281 }
283 content::WebContents* web_contents = NULL; 282 content::WebContents* web_contents = NULL;
284 if (browser) 283 if (browser)
285 web_contents = browser->tab_strip_model()->GetActiveWebContents(); 284 web_contents = browser->tab_strip_model()->GetActiveWebContents();
286 install_ui_.reset(new ExtensionInstallPrompt(web_contents)); 285 install_ui_.reset(new ExtensionInstallPrompt(web_contents));
287 if (delegated_username_.empty()) { 286 if (delegated_username_.empty()) {
288 install_ui_->ConfirmBundleInstall(this, &icon_, permissions.get()); 287 install_ui_->ConfirmBundleInstall(this, &icon_, permissions.Pass());
289 } else { 288 } else {
290 install_ui_->ConfirmPermissionsForDelegatedBundleInstall( 289 install_ui_->ConfirmPermissionsForDelegatedBundleInstall(
291 this, delegated_username_, &icon_, permissions.get()); 290 this, delegated_username_, &icon_, permissions.Pass());
292 } 291 }
293 } 292 }
294 } 293 }
295 294
296 void BundleInstaller::ShowInstalledBubbleIfDone() { 295 void BundleInstaller::ShowInstalledBubbleIfDone() {
297 // We're ready to show the installed bubble when no items are pending. 296 // We're ready to show the installed bubble when no items are pending.
298 if (HasItemWithState(Item::STATE_PENDING)) 297 if (HasItemWithState(Item::STATE_PENDING))
299 return; 298 return;
300 299
301 if (browser_) 300 if (browser_)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 358
360 ShowInstalledBubbleIfDone(); 359 ShowInstalledBubbleIfDone();
361 } 360 }
362 361
363 void BundleInstaller::OnBrowserRemoved(Browser* browser) { 362 void BundleInstaller::OnBrowserRemoved(Browser* browser) {
364 if (browser_ == browser) 363 if (browser_ == browser)
365 browser_ = nullptr; 364 browser_ = nullptr;
366 } 365 }
367 366
368 } // namespace extensions 367 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698