| 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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/extensions/bundle_installer.h" | 16 #include "chrome/browser/extensions/bundle_installer.h" |
| 17 #include "chrome/browser/extensions/extension_install_ui.h" | 17 #include "chrome/browser/extensions/extension_install_ui.h" |
| 18 #include "chrome/browser/extensions/image_loader.h" | 18 #include "chrome/browser/extensions/image_loader.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 20 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 21 #include "chrome/browser/signin/profile_oauth2_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/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" | 25 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
| 26 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
| 27 #include "chrome/common/extensions/extension_constants.h" | 27 #include "chrome/common/extensions/extension_constants.h" |
| 28 #include "chrome/common/extensions/extension_icon_set.h" | 28 #include "chrome/common/extensions/extension_icon_set.h" |
| 29 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 30 #include "chrome/common/extensions/feature_switch.h" | 29 #include "chrome/common/extensions/feature_switch.h" |
| 31 #include "chrome/common/extensions/manifest.h" | 30 #include "chrome/common/extensions/manifest.h" |
| 32 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 31 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 33 #include "chrome/common/extensions/permissions/permission_set.h" | 32 #include "chrome/common/extensions/permissions/permission_set.h" |
| 34 #include "chrome/common/extensions/permissions/permissions_data.h" | 33 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 35 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 36 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 37 #include "content/public/browser/web_contents_view.h" | 36 #include "content/public/browser/web_contents_view.h" |
| 38 #include "extensions/common/extension_resource.h" | 37 #include "extensions/common/extension_resource.h" |
| 38 #include "extensions/common/manifest_constants.h" |
| 39 #include "extensions/common/url_pattern.h" | 39 #include "extensions/common/url_pattern.h" |
| 40 #include "grit/chromium_strings.h" | 40 #include "grit/chromium_strings.h" |
| 41 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 44 #include "ui/base/resource/resource_bundle.h" | 44 #include "ui/base/resource/resource_bundle.h" |
| 45 #include "ui/gfx/image/image.h" | 45 #include "ui/gfx/image/image.h" |
| 46 | 46 |
| 47 using extensions::BundleInstaller; | 47 using extensions::BundleInstaller; |
| 48 using extensions::Extension; | 48 using extensions::Extension; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 const DictionaryValue* manifest, | 450 const DictionaryValue* manifest, |
| 451 int flags, | 451 int flags, |
| 452 const std::string& id, | 452 const std::string& id, |
| 453 const std::string& localized_name, | 453 const std::string& localized_name, |
| 454 const std::string& localized_description, | 454 const std::string& localized_description, |
| 455 std::string* error) { | 455 std::string* error) { |
| 456 scoped_ptr<DictionaryValue> localized_manifest; | 456 scoped_ptr<DictionaryValue> localized_manifest; |
| 457 if (!localized_name.empty() || !localized_description.empty()) { | 457 if (!localized_name.empty() || !localized_description.empty()) { |
| 458 localized_manifest.reset(manifest->DeepCopy()); | 458 localized_manifest.reset(manifest->DeepCopy()); |
| 459 if (!localized_name.empty()) { | 459 if (!localized_name.empty()) { |
| 460 localized_manifest->SetString(extension_manifest_keys::kName, | 460 localized_manifest->SetString(extensions::manifest_keys::kName, |
| 461 localized_name); | 461 localized_name); |
| 462 } | 462 } |
| 463 if (!localized_description.empty()) { | 463 if (!localized_description.empty()) { |
| 464 localized_manifest->SetString(extension_manifest_keys::kDescription, | 464 localized_manifest->SetString(extensions::manifest_keys::kDescription, |
| 465 localized_description); | 465 localized_description); |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 return Extension::Create( | 469 return Extension::Create( |
| 470 base::FilePath(), | 470 base::FilePath(), |
| 471 Manifest::INTERNAL, | 471 Manifest::INTERNAL, |
| 472 localized_manifest.get() ? *localized_manifest.get() : *manifest, | 472 localized_manifest.get() ? *localized_manifest.get() : *manifest, |
| 473 flags, | 473 flags, |
| 474 id, | 474 id, |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 } | 800 } |
| 801 | 801 |
| 802 if (AutoConfirmPrompt(delegate_)) | 802 if (AutoConfirmPrompt(delegate_)) |
| 803 return; | 803 return; |
| 804 | 804 |
| 805 if (show_dialog_callback_.is_null()) | 805 if (show_dialog_callback_.is_null()) |
| 806 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); | 806 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); |
| 807 else | 807 else |
| 808 show_dialog_callback_.Run(show_params_, delegate_, prompt_); | 808 show_dialog_callback_.Run(show_params_, delegate_, prompt_); |
| 809 } | 809 } |
| OLD | NEW |