OLD | NEW |
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 void BundleInstaller::ShowPrompt() { | 253 void BundleInstaller::ShowPrompt() { |
254 // Abort if we couldn't create any Extensions out of the manifests. | 254 // Abort if we couldn't create any Extensions out of the manifests. |
255 if (dummy_extensions_.empty()) { | 255 if (dummy_extensions_.empty()) { |
256 ReportCanceled(false); | 256 ReportCanceled(false); |
257 return; | 257 return; |
258 } | 258 } |
259 | 259 |
260 scoped_refptr<PermissionSet> permissions; | 260 scoped_refptr<PermissionSet> permissions; |
261 for (size_t i = 0; i < dummy_extensions_.size(); ++i) { | 261 for (size_t i = 0; i < dummy_extensions_.size(); ++i) { |
262 permissions = PermissionSet::CreateUnion( | 262 permissions = PermissionSet::CreateUnion( |
263 permissions, dummy_extensions_[i]->required_permission_set()); | 263 permissions.get(), dummy_extensions_[i]->required_permission_set()); |
264 } | 264 } |
265 | 265 |
266 if (g_auto_approve_for_test == PROCEED) { | 266 if (g_auto_approve_for_test == PROCEED) { |
267 InstallUIProceed(); | 267 InstallUIProceed(); |
268 } else if (g_auto_approve_for_test == ABORT) { | 268 } else if (g_auto_approve_for_test == ABORT) { |
269 InstallUIAbort(true); | 269 InstallUIAbort(true); |
270 } else { | 270 } else { |
271 Browser* browser = browser_; | 271 Browser* browser = browser_; |
272 if (!browser) { | 272 if (!browser) { |
273 // The browser that we got initially could have gone away during our | 273 // The browser that we got initially could have gone away during our |
274 // thread hopping. | 274 // thread hopping. |
275 browser = browser::FindLastActiveWithProfile(profile_); | 275 browser = browser::FindLastActiveWithProfile(profile_); |
276 } | 276 } |
277 content::WebContents* web_contents = NULL; | 277 content::WebContents* web_contents = NULL; |
278 if (browser) | 278 if (browser) |
279 web_contents = browser->tab_strip_model()->GetActiveWebContents(); | 279 web_contents = browser->tab_strip_model()->GetActiveWebContents(); |
280 install_ui_.reset(new ExtensionInstallPrompt(web_contents)); | 280 install_ui_.reset(new ExtensionInstallPrompt(web_contents)); |
281 install_ui_->ConfirmBundleInstall(this, permissions); | 281 install_ui_->ConfirmBundleInstall(this, permissions.get()); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 void BundleInstaller::ShowInstalledBubbleIfDone() { | 285 void BundleInstaller::ShowInstalledBubbleIfDone() { |
286 // We're ready to show the installed bubble when no items are pending. | 286 // We're ready to show the installed bubble when no items are pending. |
287 if (!GetItemsWithState(Item::STATE_PENDING).empty()) | 287 if (!GetItemsWithState(Item::STATE_PENDING).empty()) |
288 return; | 288 return; |
289 | 289 |
290 if (browser_) | 290 if (browser_) |
291 ShowInstalledBubble(this, browser_); | 291 ShowInstalledBubble(this, browser_); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 void BundleInstaller::OnBrowserAdded(Browser* browser) {} | 347 void BundleInstaller::OnBrowserAdded(Browser* browser) {} |
348 | 348 |
349 void BundleInstaller::OnBrowserRemoved(Browser* browser) { | 349 void BundleInstaller::OnBrowserRemoved(Browser* browser) { |
350 if (browser_ == browser) | 350 if (browser_ == browser) |
351 browser_ = NULL; | 351 browser_ = NULL; |
352 } | 352 } |
353 | 353 |
354 void BundleInstaller::OnBrowserSetLastActive(Browser* browser) {} | 354 void BundleInstaller::OnBrowserSetLastActive(Browser* browser) {} |
355 | 355 |
356 } // namespace extensions | 356 } // namespace extensions |
OLD | NEW |