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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/signin/token_service_factory.h" | 22 #include "chrome/browser/signin/token_service_factory.h" |
23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
24 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/extensions/api/icons/icons_handler.h" | 26 #include "chrome/common/extensions/api/icons/icons_handler.h" |
27 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" | 27 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
28 #include "chrome/common/extensions/extension.h" | 28 #include "chrome/common/extensions/extension.h" |
29 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
30 #include "chrome/common/extensions/extension_icon_set.h" | 30 #include "chrome/common/extensions/extension_icon_set.h" |
31 #include "chrome/common/extensions/extension_manifest_constants.h" | 31 #include "chrome/common/extensions/extension_manifest_constants.h" |
32 #include "chrome/common/extensions/extension_resource.h" | |
33 #include "chrome/common/extensions/feature_switch.h" | 32 #include "chrome/common/extensions/feature_switch.h" |
34 #include "chrome/common/extensions/manifest.h" | 33 #include "chrome/common/extensions/manifest.h" |
35 #include "chrome/common/extensions/permissions/permission_set.h" | 34 #include "chrome/common/extensions/permissions/permission_set.h" |
36 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
37 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
38 #include "content/public/browser/web_contents_view.h" | 37 #include "content/public/browser/web_contents_view.h" |
| 38 #include "extensions/common/extension_resource.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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 void ExtensionInstallPrompt::LoadImageIfNeeded() { | 603 void ExtensionInstallPrompt::LoadImageIfNeeded() { |
604 // Bundle install prompts do not have an icon. | 604 // Bundle install prompts do not have an icon. |
605 // Also |install_ui_.profile()| can be NULL in unit tests. | 605 // Also |install_ui_.profile()| can be NULL in unit tests. |
606 if (!icon_.empty() || !install_ui_->profile()) { | 606 if (!icon_.empty() || !install_ui_->profile()) { |
607 FetchOAuthIssueAdviceIfNeeded(); | 607 FetchOAuthIssueAdviceIfNeeded(); |
608 return; | 608 return; |
609 } | 609 } |
610 | 610 |
611 // Load the image asynchronously. For the response, check OnImageLoaded. | 611 // Load the image asynchronously. For the response, check OnImageLoaded. |
612 ExtensionResource image = extensions::IconsInfo::GetIconResource( | 612 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( |
613 extension_, | 613 extension_, |
614 extension_misc::EXTENSION_ICON_LARGE, | 614 extension_misc::EXTENSION_ICON_LARGE, |
615 ExtensionIconSet::MATCH_BIGGER); | 615 ExtensionIconSet::MATCH_BIGGER); |
616 // Load the icon whose pixel size is large enough to be displayed under | 616 // Load the icon whose pixel size is large enough to be displayed under |
617 // maximal supported scale factor. UI code will scale the icon down if needed. | 617 // maximal supported scale factor. UI code will scale the icon down if needed. |
618 // TODO(tbarzic): We should use IconImage here and load the required bitmap | 618 // TODO(tbarzic): We should use IconImage here and load the required bitmap |
619 // lazily. | 619 // lazily. |
620 int pixel_size = GetSizeForMaxScaleFactor(kIconSize); | 620 int pixel_size = GetSizeForMaxScaleFactor(kIconSize); |
621 extensions::ImageLoader::Get(install_ui_->profile())->LoadImageAsync( | 621 extensions::ImageLoader::Get(install_ui_->profile())->LoadImageAsync( |
622 extension_, image, gfx::Size(pixel_size, pixel_size), | 622 extension_, image, gfx::Size(pixel_size, pixel_size), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 } | 698 } |
699 | 699 |
700 if (AutoConfirmPrompt(delegate_)) | 700 if (AutoConfirmPrompt(delegate_)) |
701 return; | 701 return; |
702 | 702 |
703 if (show_dialog_callback_.is_null()) | 703 if (show_dialog_callback_.is_null()) |
704 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); | 704 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); |
705 else | 705 else |
706 show_dialog_callback_.Run(show_params_, delegate_, prompt_); | 706 show_dialog_callback_.Run(show_params_, delegate_, prompt_); |
707 } | 707 } |
OLD | NEW |