summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 17:46:12 +0000
committerjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 17:46:12 +0000
commit89440824cd6ef0f9cf3a286c8aa55e916ab20aa6 (patch)
treef367bcec30e471b7292d25ce155fc7e86380ada7 /chrome/browser
parent9e2f65a4250e757b6e3afb8b3b46ae24c2ab76d6 (diff)
downloadchromium_src-89440824cd6ef0f9cf3a286c8aa55e916ab20aa6.zip
chromium_src-89440824cd6ef0f9cf3a286c8aa55e916ab20aa6.tar.gz
chromium_src-89440824cd6ef0f9cf3a286c8aa55e916ab20aa6.tar.bz2
Fix IDN urls in geolocation infobars and bubbles (but not exceptions dialog)
BUG=40278 TEST=As per adhoc method in the bug. Open infobar & bubble, check they show URL in arabic Review URL: http://codereview.chromium.org/1612017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/content_setting_bubble_model.cc8
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context.cc22
2 files changed, 19 insertions, 11 deletions
diff --git a/chrome/browser/content_setting_bubble_model.cc b/chrome/browser/content_setting_bubble_model.cc
index 8cf0930..6c01be3 100644
--- a/chrome/browser/content_setting_bubble_model.cc
+++ b/chrome/browser/content_setting_bubble_model.cc
@@ -19,7 +19,7 @@
class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel {
public:
- ContentSettingTitleAndLinkModel(TabContents* tab_contents, Profile* profile,
+ ContentSettingTitleAndLinkModel(TabContents* tab_contents, Profile* profile,
ContentSettingsType content_type)
: ContentSettingBubbleModel(tab_contents, profile, content_type) {
SetTitle();
@@ -206,7 +206,11 @@ class ContentSettingDomainListBubbleModel
DomainList domains[CONTENT_SETTING_NUM_SETTINGS];
for (TabContents::GeolocationContentSettings::const_iterator it =
settings.begin(); it != settings.end(); ++it) {
- domains[it->second].hosts.insert(it->first.host());
+ std::wstring display_host_wide;
+ net::AppendFormattedHost(it->first,
+ profile()->GetPrefs()->GetString(prefs::kAcceptLanguages),
+ &display_host_wide, NULL, NULL);
+ domains[it->second].hosts.insert(WideToUTF8(display_host_wide));
const ContentSetting saved_setting =
settings_map->GetContentSetting(it->first, embedder_url);
if (saved_setting != default_setting)
diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc
index 60412ba..bf87271 100644
--- a/chrome/browser/geolocation/geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context.cc
@@ -6,24 +6,23 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "base/file_util.h"
#include "chrome/browser/browser.h"
-#include "chrome/browser/browser_list.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/geolocation/geolocation_dispatcher_host.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_view_host_notification_task.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_util.h"
-#include "chrome/common/json_value_serializer.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
+#include "net/base/net_util.h"
namespace {
@@ -33,14 +32,16 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
GeolocationConfirmInfoBarDelegate(
TabContents* tab_contents, GeolocationPermissionContext* context,
int render_process_id, int render_view_id, int bridge_id,
- const GURL& requesting_frame_url)
+ const GURL& requesting_frame_url,
+ const std::wstring& display_languages)
: ConfirmInfoBarDelegate(tab_contents),
tab_contents_(tab_contents),
context_(context),
render_process_id_(render_process_id),
render_view_id_(render_view_id),
bridge_id_(bridge_id),
- requesting_frame_url_(requesting_frame_url) {
+ requesting_frame_url_(requesting_frame_url),
+ display_languages_(display_languages) {
}
// ConfirmInfoBarDelegate
@@ -68,7 +69,8 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual std::wstring GetMessageText() const {
return l10n_util::GetStringF(
IDS_GEOLOCATION_INFOBAR_QUESTION,
- UTF8ToWide(requesting_frame_url_.GetOrigin().spec()));
+ net::FormatUrl(requesting_frame_url_.GetOrigin(), display_languages_,
+ true, UnescapeRule::SPACES, NULL, NULL, NULL));
}
virtual SkBitmap* GetIcon() const {
return ResourceBundle::GetSharedInstance().GetBitmapNamed(
@@ -99,6 +101,7 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
int render_view_id_;
int bridge_id_;
GURL requesting_frame_url_;
+ std::wstring display_languages_;
DISALLOW_IMPLICIT_CONSTRUCTORS(GeolocationConfirmInfoBarDelegate);
};
@@ -178,7 +181,7 @@ void GeolocationPermissionContext::RequestGeolocationPermission(
} else if (content_setting == CONTENT_SETTING_ALLOW) {
NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
requesting_frame, true);
- } else { // setting == ask. Prompt the user.
+ } else { // setting == ask. Prompt the user.
RequestPermissionFromUI(tab_contents, render_process_id, render_view_id,
bridge_id, requesting_frame);
}
@@ -300,7 +303,8 @@ void GeolocationPermissionContext::ShowQueuedInfoBar(
i->infobar_delegate =
new GeolocationConfirmInfoBarDelegate(
tab_contents, this, render_process_id, render_view_id,
- i->bridge_id, i->requesting_frame);
+ i->bridge_id, i->requesting_frame,
+ profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
tab_contents->AddInfoBar(i->infobar_delegate);
break;
}