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

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

Issue 10828198: Update oauth strings for extension install UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit tests Created 8 years, 4 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 a47f415a89063479b56152954ce5776fbff1f13d..bee5818cdeb8f3a512844a89e268a35d855dadd3 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/extensions/bundle_installer.h"
#include "chrome/browser/extensions/extension_install_dialog.h"
#include "chrome/browser/extensions/extension_install_ui.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/token_service.h"
#include "chrome/browser/signin/token_service_factory.h"
@@ -30,6 +31,7 @@
#include "chrome/common/extensions/extension_switch_utils.h"
#include "chrome/common/extensions/permissions/permission_set.h"
#include "chrome/common/extensions/url_pattern.h"
+#include "chrome/common/pref_names.h"
#include "content/public/browser/page_navigator.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -78,6 +80,14 @@ static const int kPermissionsHeaderIds[
IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO,
IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO,
};
+static const int kOAuthHeaderIds[
+ ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
+ IDS_EXTENSION_PROMPT_OAUTH_HEADER,
+ 0, // Inline installs don't show OAuth permissions.
+ 0, // Bundle installs don't show OAuth permissions.
+ IDS_EXTENSION_PROMPT_OAUTH_REENABLE_HEADER,
+ IDS_EXTENSION_PROMPT_OAUTH_PERMISSIONS_HEADER,
+};
namespace {
@@ -86,12 +96,13 @@ const int kIconSize = 69;
} // namespace
-ExtensionInstallPrompt::Prompt::Prompt(PromptType type)
+ExtensionInstallPrompt::Prompt::Prompt(Profile* profile, PromptType type)
: type_(type),
extension_(NULL),
bundle_(NULL),
average_rating_(0.0),
- rating_count_(0) {
+ rating_count_(0),
+ profile_(profile) {
}
ExtensionInstallPrompt::Prompt::~Prompt() {
@@ -118,7 +129,6 @@ void ExtensionInstallPrompt::Prompt::SetInlineInstallWebstoreData(
}
string16 ExtensionInstallPrompt::Prompt::GetDialogTitle() const {
-
int resource_id = kTitleIds[type_];
if (type_ == INSTALL_PROMPT) {
@@ -162,8 +172,14 @@ string16 ExtensionInstallPrompt::Prompt::GetPermissionsHeading() const {
}
string16 ExtensionInstallPrompt::Prompt::GetOAuthHeading() const {
- // TODO(estade): this should change based on type_.
- return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_SCOPES_HEADING);
+ string16 username("username@example.com");
+ // |profile_| can be NULL in unit tests.
+ if (profile_) {
+ username = UTF8ToUTF16(profile_->GetPrefs()->GetString(
Mihai Parparita -not on Chrome 2012/08/11 00:13:24 Isn't it possible for the user to not be signed in
Evan Stade 2012/08/11 00:25:44 Yes. However we won't show the oauth permissions i
+ prefs::kGoogleServicesUsername));
+ }
+ int resource_id = kOAuthHeaderIds[type_];
+ return l10n_util::GetStringFUTF16(resource_id, username);
}
void ExtensionInstallPrompt::Prompt::AppendRatingStars(
@@ -271,7 +287,7 @@ ExtensionInstallPrompt::ExtensionInstallPrompt(
extension_(NULL),
install_ui_(ExtensionInstallUI::Create(profile)),
delegate_(NULL),
- prompt_(UNSET_PROMPT_TYPE),
+ prompt_(profile, UNSET_PROMPT_TYPE),
prompt_type_(UNSET_PROMPT_TYPE),
ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) {
}
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.h ('k') | chrome/browser/extensions/webstore_inline_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698