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