summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc6
-rw-r--r--chrome/common/net/gaia/oauth2_mint_token_flow.cc9
-rw-r--r--chrome/common/net/gaia/oauth2_mint_token_flow.h5
-rw-r--r--chrome/common/net/gaia/oauth2_mint_token_flow_unittest.cc11
4 files changed, 19 insertions, 12 deletions
diff --git a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
index 62a4e66..c2158b8 100644
--- a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
@@ -336,14 +336,14 @@ GtkWidget* ExtensionInstallDialog::CreateWidgetForIssueAdvice(
if (issue_advice.details.empty()) {
label = gtk_label_new(l10n_util::GetStringFUTF8(
IDS_EXTENSION_PERMISSION_LINE,
- UTF8ToUTF16(issue_advice.description)).c_str());
+ issue_advice.description).c_str());
} else {
arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
GtkRequisition req;
gtk_widget_size_request(arrow, &req);
label_pixel_width -= req.width;
- label = gtk_label_new(issue_advice.description.c_str());
+ label = gtk_label_new(UTF16ToUTF8(issue_advice.description).c_str());
GtkWidget* detail_box = gtk_vbox_new(FALSE, ui::kControlSpacing);
gtk_box_pack_start(GTK_BOX(box), detail_box, FALSE, FALSE, 0);
@@ -352,7 +352,7 @@ GtkWidget* ExtensionInstallDialog::CreateWidgetForIssueAdvice(
for (size_t i = 0; i < issue_advice.details.size(); ++i) {
std::string text = l10n_util::GetStringFUTF8(
- IDS_EXTENSION_PERMISSION_LINE, UTF8ToUTF16(issue_advice.details[i]));
+ IDS_EXTENSION_PERMISSION_LINE, issue_advice.details[i]);
GtkWidget* label = gtk_label_new(text.c_str());
gtk_util::SetLabelWidth(label, pixel_width - kDetailIndent);
diff --git a/chrome/common/net/gaia/oauth2_mint_token_flow.cc b/chrome/common/net/gaia/oauth2_mint_token_flow.cc
index a532f18..511b8b4 100644
--- a/chrome/common/net/gaia/oauth2_mint_token_flow.cc
+++ b/chrome/common/net/gaia/oauth2_mint_token_flow.cc
@@ -14,6 +14,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/net/gaia/gaia_urls.h"
@@ -238,7 +239,7 @@ bool OAuth2MintTokenFlow::ParseIssueAdviceResponse(
for (size_t index = 0; index < scopes_list->GetSize(); ++index) {
base::DictionaryValue* scopes_entry = NULL;
IssueAdviceInfoEntry entry;
- std::string detail;
+ string16 detail;
if (!scopes_list->GetDictionary(index, &scopes_entry) ||
!scopes_entry->GetString(kDescriptionKey, &entry.description) ||
!scopes_entry->GetString(kDetailKey, &detail)) {
@@ -246,7 +247,11 @@ bool OAuth2MintTokenFlow::ParseIssueAdviceResponse(
break;
}
- Tokenize(detail, kDetailSeparators, &entry.details);
+ TrimWhitespace(entry.description, TRIM_ALL, &entry.description);
+ static const string16 detail_separators = ASCIIToUTF16(kDetailSeparators);
+ Tokenize(detail, detail_separators, &entry.details);
+ for (size_t i = 0; i < entry.details.size(); i++)
+ TrimWhitespace(entry.details[i], TRIM_ALL, &entry.details[i]);
issue_advice->push_back(entry);
}
diff --git a/chrome/common/net/gaia/oauth2_mint_token_flow.h b/chrome/common/net/gaia/oauth2_mint_token_flow.h
index fdd4dd0..2fb64ce 100644
--- a/chrome/common/net/gaia/oauth2_mint_token_flow.h
+++ b/chrome/common/net/gaia/oauth2_mint_token_flow.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/memory/weak_ptr.h"
+#include "base/string16.h"
#include "chrome/common/net/gaia/oauth2_api_call_flow.h"
class GoogleServiceAuthError;
@@ -42,8 +43,8 @@ struct IssueAdviceInfoEntry {
IssueAdviceInfoEntry();
~IssueAdviceInfoEntry();
- std::string description;
- std::vector<std::string> details;
+ string16 description;
+ std::vector<string16> details;
bool operator==(const IssueAdviceInfoEntry& rhs) const;
};
diff --git a/chrome/common/net/gaia/oauth2_mint_token_flow_unittest.cc b/chrome/common/net/gaia/oauth2_mint_token_flow_unittest.cc
index 77213cd..4ccb00a 100644
--- a/chrome/common/net/gaia/oauth2_mint_token_flow_unittest.cc
+++ b/chrome/common/net/gaia/oauth2_mint_token_flow_unittest.cc
@@ -10,6 +10,7 @@
#include "base/json/json_reader.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
+#include "base/utf_string_conversions.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
#include "chrome/common/net/gaia/oauth2_mint_token_flow.h"
#include "net/url_request/test_url_fetcher_factory.h"
@@ -109,13 +110,13 @@ std::vector<std::string> CreateTestScopes() {
static IssueAdviceInfo CreateIssueAdvice() {
IssueAdviceInfo ia;
IssueAdviceInfoEntry e1;
- e1.description = "Manage your calendars";
- e1.details.push_back("View and manage your calendars");
+ e1.description = ASCIIToUTF16("Manage your calendars");
+ e1.details.push_back(ASCIIToUTF16("View and manage your calendars"));
ia.push_back(e1);
IssueAdviceInfoEntry e2;
- e2.description = "Manage your documents";
- e2.details.push_back("View your documents");
- e2.details.push_back("Upload new documents");
+ e2.description = ASCIIToUTF16("Manage your documents");
+ e2.details.push_back(ASCIIToUTF16("View your documents"));
+ e2.details.push_back(ASCIIToUTF16("Upload new documents"));
ia.push_back(e2);
return ia;
}