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/extension_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/signin/token_service_factory.h" | 21 #include "chrome/browser/signin/token_service_factory.h" |
22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
24 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
27 #include "chrome/common/extensions/extension_icon_set.h" | 27 #include "chrome/common/extensions/extension_icon_set.h" |
28 #include "chrome/common/extensions/extension_manifest_constants.h" | 28 #include "chrome/common/extensions/extension_manifest_constants.h" |
29 #include "chrome/common/extensions/extension_resource.h" | 29 #include "chrome/common/extensions/extension_resource.h" |
30 #include "chrome/common/extensions/extension_switch_utils.h" | 30 #include "chrome/common/extensions/extension_switch_utils.h" |
| 31 #include "chrome/common/extensions/permissions/permission_set.h" |
31 #include "chrome/common/extensions/url_pattern.h" | 32 #include "chrome/common/extensions/url_pattern.h" |
32 #include "content/public/browser/page_navigator.h" | 33 #include "content/public/browser/page_navigator.h" |
33 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
34 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
35 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
37 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
38 #include "ui/gfx/image/image.h" | 39 #include "ui/gfx/image/image.h" |
39 | 40 |
40 using extensions::BundleInstaller; | 41 using extensions::BundleInstaller; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 462 } |
462 | 463 |
463 void ExtensionInstallPrompt::OnMintTokenFailure( | 464 void ExtensionInstallPrompt::OnMintTokenFailure( |
464 const GoogleServiceAuthError& error) { | 465 const GoogleServiceAuthError& error) { |
465 ShowConfirmation(); | 466 ShowConfirmation(); |
466 } | 467 } |
467 | 468 |
468 void ExtensionInstallPrompt::ShowConfirmation() { | 469 void ExtensionInstallPrompt::ShowConfirmation() { |
469 prompt_.set_type(prompt_type_); | 470 prompt_.set_type(prompt_type_); |
470 | 471 |
471 if (permissions_) | 472 if (permissions_) { |
472 prompt_.SetPermissions(permissions_->GetWarningMessages()); | 473 prompt_.SetPermissions( |
| 474 permissions_->GetWarningMessages(extension_->GetType())); |
| 475 } |
473 | 476 |
474 switch (prompt_type_) { | 477 switch (prompt_type_) { |
475 case PERMISSIONS_PROMPT: | 478 case PERMISSIONS_PROMPT: |
476 case RE_ENABLE_PROMPT: | 479 case RE_ENABLE_PROMPT: |
477 case INLINE_INSTALL_PROMPT: | 480 case INLINE_INSTALL_PROMPT: |
478 case INSTALL_PROMPT: { | 481 case INSTALL_PROMPT: { |
479 prompt_.set_extension(extension_); | 482 prompt_.set_extension(extension_); |
480 prompt_.set_icon(gfx::Image(icon_)); | 483 prompt_.set_icon(gfx::Image(icon_)); |
481 ShowExtensionInstallDialog(parent_, navigator_, delegate_, prompt_); | 484 ShowExtensionInstallDialog(parent_, navigator_, delegate_, prompt_); |
482 break; | 485 break; |
(...skipping 21 matching lines...) Expand all Loading... |
504 Browser* browser) { | 507 Browser* browser) { |
505 // |browser| can be NULL in unit tests. | 508 // |browser| can be NULL in unit tests. |
506 if (!browser) | 509 if (!browser) |
507 return new ExtensionInstallPrompt(NULL, NULL, NULL); | 510 return new ExtensionInstallPrompt(NULL, NULL, NULL); |
508 gfx::NativeWindow parent = | 511 gfx::NativeWindow parent = |
509 browser->window() ? browser->window()->GetNativeWindow() : NULL; | 512 browser->window() ? browser->window()->GetNativeWindow() : NULL; |
510 return new ExtensionInstallPrompt(parent, browser, browser->profile()); | 513 return new ExtensionInstallPrompt(parent, browser, browser->profile()); |
511 } | 514 } |
512 | 515 |
513 } // namespace chrome | 516 } // namespace chrome |
OLD | NEW |