Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Unified Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 12212195: Re-land "view permission" feature (r179916) with Mac Fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac Fix Integrated Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_install_prompt.cc
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc
index 523ead18168125c452f31190e380eb2e93f5e340..cacb466cc16886325b9b52679c2cfdfd79115ed3 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -57,6 +57,7 @@ static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE,
IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE,
IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_TITLE,
+ IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_TITLE,
};
static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
IDS_EXTENSION_INSTALL_PROMPT_HEADING,
@@ -65,6 +66,16 @@ static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING,
IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING,
0, // External installs use different strings for extensions/apps.
+ IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_HEADING,
+};
+static const int kButtons[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
+ ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
+ ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
+ ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
+ ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
+ ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
+ ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
+ ui::DIALOG_BUTTON_CANCEL,
};
static const int kAcceptButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
IDS_EXTENSION_PROMPT_INSTALL_BUTTON,
@@ -73,6 +84,7 @@ static const int kAcceptButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON,
IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON,
0, // External installs use different strings for extensions/apps.
+ 0,
};
static const int kAbortButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
0, // These all use the platform's default cancel label.
@@ -81,6 +93,7 @@ static const int kAbortButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
0,
IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON,
IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ABORT_BUTTON,
+ IDS_CLOSE,
};
static const int kPermissionsHeaderIds[
ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
@@ -90,6 +103,7 @@ static const int kPermissionsHeaderIds[
IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO,
IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO,
IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
+ IDS_EXTENSION_PROMPT_CAN_ACCESS,
};
static const int kOAuthHeaderIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
IDS_EXTENSION_PROMPT_OAUTH_HEADER,
@@ -100,6 +114,7 @@ static const int kOAuthHeaderIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
// TODO(mpcomplete): Do we need this for external install UI? If we do,
// we need to update FetchOAuthIssueAdviceIfNeeded.
0,
+ 0,
};
// Size of extension icon in top left of dialog.
@@ -247,6 +262,14 @@ string16 ExtensionInstallPrompt::Prompt::GetHeading() const {
}
}
+int ExtensionInstallPrompt::Prompt::GetDialogButtons() const {
+ return kButtons[type_];
+}
+
+bool ExtensionInstallPrompt::Prompt::HasAcceptButtonLabel() const {
+ return kAcceptButtonIds[type_] > 0;
+}
+
string16 ExtensionInstallPrompt::Prompt::GetAcceptButtonLabel() const {
if (type_ == EXTERNAL_INSTALL_PROMPT) {
int id = -1;
@@ -532,6 +555,17 @@ void ExtensionInstallPrompt::ConfirmIssueAdvice(
LoadImageIfNeeded();
}
+void ExtensionInstallPrompt::ReviewPermissions(Delegate* delegate,
+ const Extension* extension) {
+ DCHECK(ui_loop_ == MessageLoop::current());
+ extension_ = extension;
+ permissions_ = extension->GetActivePermissions();
+ delegate_ = delegate;
+ prompt_.set_type(POST_INSTALL_PERMISSIONS_PROMPT);
+
+ LoadImageIfNeeded();
+}
+
void ExtensionInstallPrompt::OnInstallSuccess(const Extension* extension,
SkBitmap* icon) {
extension_ = extension;
@@ -644,7 +678,8 @@ void ExtensionInstallPrompt::ShowConfirmation() {
case RE_ENABLE_PROMPT:
case INLINE_INSTALL_PROMPT:
case EXTERNAL_INSTALL_PROMPT:
- case INSTALL_PROMPT: {
+ case INSTALL_PROMPT:
+ case POST_INSTALL_PERMISSIONS_PROMPT: {
prompt_.set_extension(extension_);
prompt_.set_icon(gfx::Image::CreateFrom1xBitmap(icon_));
break;
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.h ('k') | chrome/browser/resources/extensions/extension_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698