summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:29:17 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:29:17 +0000
commitbd14784bcadf8cf55ae92e713a2545245bb02826 (patch)
tree7cf74d7dfa33e0dd46f4c0b0e32d788f53143e29
parent94d2c4067766e532bfd7b61a9b7f0a0616325642 (diff)
downloadchromium_src-bd14784bcadf8cf55ae92e713a2545245bb02826.zip
chromium_src-bd14784bcadf8cf55ae92e713a2545245bb02826.tar.gz
chromium_src-bd14784bcadf8cf55ae92e713a2545245bb02826.tar.bz2
Disable remember option in cookie prompt and content blocked notification bubbles when running OTR.
BUG=37525 TEST=Manual, check cookie prompt and bubbles in OTR session Review URL: http://codereview.chromium.org/1629011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44084 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/nibs/CookiePrompt.xib12
-rw-r--r--chrome/browser/cocoa/content_blocked_bubble_controller.mm3
-rw-r--r--chrome/browser/cocoa/cookie_prompt_window_controller.h1
-rw-r--r--chrome/browser/cocoa/cookie_prompt_window_controller.mm4
-rw-r--r--chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm40
-rw-r--r--chrome/browser/content_setting_bubble_model.cc2
-rw-r--r--chrome/browser/content_setting_bubble_model.h1
-rw-r--r--chrome/browser/cookie_modal_dialog.cc10
-rw-r--r--chrome/browser/cookie_modal_dialog.h4
-rw-r--r--chrome/browser/cookie_modal_dialog_gtk.cc5
-rw-r--r--chrome/browser/gtk/content_setting_bubble_gtk.cc1
-rw-r--r--chrome/browser/host_content_settings_map.cc32
-rw-r--r--chrome/browser/host_content_settings_map.h6
-rw-r--r--chrome/browser/profile.cc10
-rw-r--r--chrome/browser/views/content_blocked_bubble_contents.cc1
-rw-r--r--chrome/browser/views/cookie_prompt_view.cc9
16 files changed, 121 insertions, 20 deletions
diff --git a/chrome/app/nibs/CookiePrompt.xib b/chrome/app/nibs/CookiePrompt.xib
index 233d8f2..afb028f 100644
--- a/chrome/app/nibs/CookiePrompt.xib
+++ b/chrome/app/nibs/CookiePrompt.xib
@@ -562,6 +562,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<int key="connectionID">160</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">askChoiceCell_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="969084885"/>
+ </object>
+ <int key="connectionID">161</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -849,7 +857,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">160</int>
+ <int key="maxID">161</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -884,6 +892,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>askChoiceCell_</string>
<string>description_</string>
<string>disclosedViewPlaceholder_</string>
<string>disclosureButtonSuperView_</string>
@@ -893,6 +902,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSButtonCell</string>
<string>NSTextField</string>
<string>NSView</string>
<string>NSView</string>
diff --git a/chrome/browser/cocoa/content_blocked_bubble_controller.mm b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
index fd4d979..8b88c0c 100644
--- a/chrome/browser/cocoa/content_blocked_bubble_controller.mm
+++ b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
@@ -178,9 +178,10 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
const ContentSettingBubbleModel::RadioGroup& radioGroup =
contentSettingBubbleModel_->bubble_content().radio_group;
- // Select appropriate radio button..
+ // Initialize radio group state.
[allowBlockRadioGroup_ selectCellWithTag:
radioGroup.default_item == 0 ? kAllowTag : kBlockTag];
+ [allowBlockRadioGroup_ setEnabled:radioGroup.is_mutable];
// Copy |host_| into radio group label.
NSCell* radioCell = [allowBlockRadioGroup_ cellWithTag:kAllowTag];
diff --git a/chrome/browser/cocoa/cookie_prompt_window_controller.h b/chrome/browser/cocoa/cookie_prompt_window_controller.h
index 6ae68b4..3f440db 100644
--- a/chrome/browser/cocoa/cookie_prompt_window_controller.h
+++ b/chrome/browser/cocoa/cookie_prompt_window_controller.h
@@ -39,6 +39,7 @@ class CookieTreeNode;
IBOutlet NSView* disclosureButtonSuperView_;
IBOutlet NSMatrix* radioGroupMatrix_;
IBOutlet NSButtonCell* rememberChoiceCell_;
+ IBOutlet NSButtonCell* askChoiceCell_;
}
// Designated initializer.
diff --git a/chrome/browser/cocoa/cookie_prompt_window_controller.mm b/chrome/browser/cocoa/cookie_prompt_window_controller.mm
index 779d506..f3dbcc0 100644
--- a/chrome/browser/cocoa/cookie_prompt_window_controller.mm
+++ b/chrome/browser/cocoa/cookie_prompt_window_controller.mm
@@ -138,6 +138,10 @@ static const CGFloat kExtraMarginForDetailsView = 10;
[self doLayoutTweaks];
[self replaceCookieDetailsView];
+ bool rememberEnabled = dialog_->DecisionPersistable();
+ [radioGroupMatrix_ setEnabled:rememberEnabled];
+ [radioGroupMatrix_ selectCell:(
+ rememberEnabled ? rememberChoiceCell_ : askChoiceCell_)];
[[detailsViewController_ view] setHidden:YES];
}
diff --git a/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm b/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm
index ea20982..123b96d 100644
--- a/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/cookie_prompt_window_controller_unittest.mm
@@ -6,6 +6,7 @@
#include "chrome/browser/cocoa/cocoa_test_helper.h"
#include "chrome/browser/cocoa/cookie_prompt_window_controller.h"
#include "chrome/browser/cookie_modal_dialog.h"
+#include "chrome/test/testing_profile.h"
// A mock class which implements just enough functionality to
// act as a radio with a pre-specified selected button.
@@ -40,7 +41,8 @@ namespace {
class CookiePromptModalDialogMock : public CookiePromptModalDialog {
public:
CookiePromptModalDialogMock(const GURL& origin,
- const std::string& cookie_line);
+ const std::string& cookieLine,
+ HostContentSettingsMap* hostContentSettingsMap);
virtual void AllowSiteData(bool remember, bool session_expire);
virtual void BlockSiteData(bool remember);
@@ -59,8 +61,10 @@ class CookiePromptModalDialogMock : public CookiePromptModalDialog {
CookiePromptModalDialogMock::CookiePromptModalDialogMock(
const GURL& origin,
- const std::string& cookie_line)
- : CookiePromptModalDialog(NULL, NULL, origin, cookie_line, NULL),
+ const std::string& cookieLine,
+ HostContentSettingsMap* hostContentSettingsMap)
+ : CookiePromptModalDialog(NULL, hostContentSettingsMap, origin, cookieLine,
+ NULL),
allow_(false),
remember_(false) {
}
@@ -77,6 +81,13 @@ void CookiePromptModalDialogMock::BlockSiteData(bool remember) {
}
class CookiePromptWindowControllerTest : public CocoaTest {
+ public:
+ CookiePromptWindowControllerTest() {
+ hostContentSettingsMap_ = profile_.GetHostContentSettingsMap();
+ }
+
+ TestingProfile profile_;
+ scoped_refptr<HostContentSettingsMap> hostContentSettingsMap_;
};
TEST_F(CookiePromptWindowControllerTest, CreateForCookie) {
@@ -84,7 +95,8 @@ TEST_F(CookiePromptWindowControllerTest, CreateForCookie) {
std::string cookieLine(
"PHPSESSID=0123456789abcdef0123456789abcdef; path=/");
scoped_ptr<CookiePromptModalDialog> dialog(
- new CookiePromptModalDialog(NULL, NULL, url, cookieLine, NULL));
+ new CookiePromptModalDialog(NULL, hostContentSettingsMap_, url,
+ cookieLine, NULL));
scoped_nsobject<CookiePromptWindowController> controller(
[[CookiePromptWindowController alloc] initWithDialog:dialog.get()]);
EXPECT_TRUE(controller.get());
@@ -96,8 +108,9 @@ TEST_F(CookiePromptWindowControllerTest, CreateForDatabase) {
string16 databaseName(base::SysNSStringToUTF16(@"some database"));
string16 databaseDescription(base::SysNSStringToUTF16(@"some desc"));
scoped_ptr<CookiePromptModalDialog> dialog(
- new CookiePromptModalDialog(NULL, NULL, url, databaseName,
- databaseDescription, 3456, NULL));
+ new CookiePromptModalDialog(NULL, hostContentSettingsMap_,
+ url, databaseName, databaseDescription, 3456,
+ NULL));
scoped_nsobject<CookiePromptWindowController> controller(
[[CookiePromptWindowController alloc] initWithDialog:dialog.get()]);
EXPECT_TRUE(controller.get());
@@ -109,7 +122,8 @@ TEST_F(CookiePromptWindowControllerTest, CreateForLocalStorage) {
string16 key(base::SysNSStringToUTF16(@"key"));
string16 value(base::SysNSStringToUTF16(@"value"));
scoped_ptr<CookiePromptModalDialog> dialog(
- new CookiePromptModalDialog(NULL, NULL, url, key, value, NULL));
+ new CookiePromptModalDialog(NULL, hostContentSettingsMap_, url, key,
+ value, NULL));
scoped_nsobject<CookiePromptWindowController> controller(
[[CookiePromptWindowController alloc] initWithDialog:dialog.get()]);
EXPECT_TRUE(controller.get());
@@ -121,7 +135,8 @@ TEST_F(CookiePromptWindowControllerTest, RememberMyChoiceAllow) {
std::string cookieLine(
"PHPSESSID=0123456789abcdef0123456789abcdef; path=/");
scoped_ptr<CookiePromptModalDialogMock> dialog(
- new CookiePromptModalDialogMock(url, cookieLine));
+ new CookiePromptModalDialogMock(url, cookieLine,
+ hostContentSettingsMap_));
scoped_nsobject<CookiePromptWindowController> controller(
[[CookiePromptWindowController alloc] initWithDialog:dialog.get()]);
scoped_nsobject<MockRadioButtonMatrix> checkbox([[MockRadioButtonMatrix alloc]
@@ -146,7 +161,8 @@ TEST_F(CookiePromptWindowControllerTest, RememberMyChoiceBlock) {
std::string cookieLine(
"PHPSESSID=0123456789abcdef0123456789abcdef; path=/");
scoped_ptr<CookiePromptModalDialogMock> dialog(
- new CookiePromptModalDialogMock(url, cookieLine));
+ new CookiePromptModalDialogMock(url, cookieLine,
+ hostContentSettingsMap_));
scoped_nsobject<CookiePromptWindowController> controller(
[[CookiePromptWindowController alloc] initWithDialog:dialog.get()]);
scoped_nsobject<MockRadioButtonMatrix> checkbox([[MockRadioButtonMatrix alloc]
@@ -171,7 +187,8 @@ TEST_F(CookiePromptWindowControllerTest, DontRememberMyChoiceAllow) {
std::string cookieLine(
"PHPSESSID=0123456789abcdef0123456789abcdef; path=/");
scoped_ptr<CookiePromptModalDialogMock> dialog(
- new CookiePromptModalDialogMock(url, cookieLine));
+ new CookiePromptModalDialogMock(url, cookieLine,
+ hostContentSettingsMap_));
scoped_nsobject<CookiePromptWindowController> controller(
[[CookiePromptWindowController alloc] initWithDialog:dialog.get()]);
scoped_nsobject<MockRadioButtonMatrix> checkbox([[MockRadioButtonMatrix alloc]
@@ -196,7 +213,8 @@ TEST_F(CookiePromptWindowControllerTest, DontRememberMyChoiceBlock) {
std::string cookieLine(
"PHPSESSID=0123456789abcdef0123456789abcdef; path=/");
scoped_ptr<CookiePromptModalDialogMock> dialog(
- new CookiePromptModalDialogMock(url, cookieLine));
+ new CookiePromptModalDialogMock(url, cookieLine,
+ hostContentSettingsMap_));
scoped_nsobject<CookiePromptWindowController> controller(
[[CookiePromptWindowController alloc] initWithDialog:dialog.get()]);
scoped_nsobject<MockRadioButtonMatrix> checkbox([[MockRadioButtonMatrix alloc]
diff --git a/chrome/browser/content_setting_bubble_model.cc b/chrome/browser/content_setting_bubble_model.cc
index e385029..8cf0930 100644
--- a/chrome/browser/content_setting_bubble_model.cc
+++ b/chrome/browser/content_setting_bubble_model.cc
@@ -115,6 +115,8 @@ class ContentSettingSingleRadioGroup : public ContentSettingTitleAndLinkModel {
radio_group.default_item =
profile()->GetHostContentSettingsMap()->GetContentSetting(url,
content_type()) == CONTENT_SETTING_ALLOW ? 0 : 1;
+ radio_group.is_mutable =
+ !profile()->GetHostContentSettingsMap()->IsOffTheRecord();
set_radio_group(radio_group);
}
diff --git a/chrome/browser/content_setting_bubble_model.h b/chrome/browser/content_setting_bubble_model.h
index 18cf6ac..e760340 100644
--- a/chrome/browser/content_setting_bubble_model.h
+++ b/chrome/browser/content_setting_bubble_model.h
@@ -45,6 +45,7 @@ class ContentSettingBubbleModel : public NotificationObserver {
std::string title;
RadioItems radio_items;
int default_item;
+ bool is_mutable;
};
struct DomainList {
diff --git a/chrome/browser/cookie_modal_dialog.cc b/chrome/browser/cookie_modal_dialog.cc
index 1e1526c..0135fad 100644
--- a/chrome/browser/cookie_modal_dialog.cc
+++ b/chrome/browser/cookie_modal_dialog.cc
@@ -99,7 +99,8 @@ bool CookiePromptModalDialog::IsValid() {
void CookiePromptModalDialog::AllowSiteData(bool remember,
bool session_expire) {
- if (remember) {
+ DCHECK(!remember || DecisionPersistable());
+ if (remember && DecisionPersistable()) {
host_content_settings_map_->SetContentSetting(
HostContentSettingsMap::Pattern::FromURL(origin_),
CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_ALLOW);
@@ -112,7 +113,8 @@ void CookiePromptModalDialog::AllowSiteData(bool remember,
}
void CookiePromptModalDialog::BlockSiteData(bool remember) {
- if (remember) {
+ DCHECK(!remember || DecisionPersistable());
+ if (remember && DecisionPersistable()) {
host_content_settings_map_->SetContentSetting(
HostContentSettingsMap::Pattern::FromURL(origin_),
CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK);
@@ -134,3 +136,7 @@ int CookiePromptModalDialog::GetDialogButtons() {
return MessageBoxFlags::DIALOGBUTTON_OK |
MessageBoxFlags::DIALOGBUTTON_CANCEL;
}
+
+bool CookiePromptModalDialog::DecisionPersistable() {
+ return !host_content_settings_map_->IsOffTheRecord();
+}
diff --git a/chrome/browser/cookie_modal_dialog.h b/chrome/browser/cookie_modal_dialog.h
index bfc2b67..8e1d5e4 100644
--- a/chrome/browser/cookie_modal_dialog.h
+++ b/chrome/browser/cookie_modal_dialog.h
@@ -72,6 +72,9 @@ class CookiePromptModalDialog : public AppModalDialog {
virtual void CancelWindow();
virtual bool IsValid();
+ // Whether the user may choose to have the browser remember the decision.
+ bool DecisionPersistable();
+
#if defined(OS_MACOSX)
virtual void CloseModalDialog();
#endif
@@ -136,4 +139,3 @@ class CookiePromptModalDialog : public AppModalDialog {
};
#endif // CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_
-
diff --git a/chrome/browser/cookie_modal_dialog_gtk.cc b/chrome/browser/cookie_modal_dialog_gtk.cc
index c7d7f16..557fe3d 100644
--- a/chrome/browser/cookie_modal_dialog_gtk.cc
+++ b/chrome/browser/cookie_modal_dialog_gtk.cc
@@ -82,15 +82,20 @@ NativeDialog CookiePromptModalDialog::CreateNativeDialog() {
// Create a vbox for all the radio buttons so they aren't too far away from
// each other.
+ bool remember_enabled = DecisionPersistable();
GtkWidget* radio_box = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
remember_radio_ = gtk_radio_button_new_with_label(NULL,
l10n_util::GetStringFUTF8(IDS_COOKIE_ALERT_REMEMBER_RADIO,
display_host).c_str());
+ gtk_widget_set_sensitive(GTK_WIDGET(remember_radio_), remember_enabled);
gtk_box_pack_start(GTK_BOX(radio_box), remember_radio_, FALSE, FALSE, 0);
GtkWidget* ask_radio = gtk_radio_button_new_with_label_from_widget(
GTK_RADIO_BUTTON(remember_radio_),
l10n_util::GetStringUTF8(IDS_COOKIE_ALERT_ASK_RADIO).c_str());
+ gtk_widget_set_sensitive(GTK_WIDGET(ask_radio), remember_enabled);
+ if (!remember_enabled)
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ask_radio), true);
gtk_box_pack_start(GTK_BOX(radio_box), ask_radio, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(content_area), radio_box, FALSE, FALSE, 0);
diff --git a/chrome/browser/gtk/content_setting_bubble_gtk.cc b/chrome/browser/gtk/content_setting_bubble_gtk.cc
index 48430eb..6d46325 100644
--- a/chrome/browser/gtk/content_setting_bubble_gtk.cc
+++ b/chrome/browser/gtk/content_setting_bubble_gtk.cc
@@ -131,6 +131,7 @@ void ContentSettingBubbleGtk::BuildBubble() {
gtk_radio_button_new_with_label_from_widget(
GTK_RADIO_BUTTON(radio_group_gtk_[0]),
i->c_str());
+ gtk_widget_set_sensitive(radio, radio_group.is_mutable);
gtk_box_pack_start(GTK_BOX(bubble_content), radio, FALSE, FALSE, 0);
if (i - radio_group.radio_items.begin() == radio_group.default_item) {
// We must set the default value before we attach the signal handlers
diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc
index fd7517a..378dfad 100644
--- a/chrome/browser/host_content_settings_map.cc
+++ b/chrome/browser/host_content_settings_map.cc
@@ -102,7 +102,8 @@ const ContentSetting
HostContentSettingsMap::HostContentSettingsMap(Profile* profile)
: profile_(profile),
- block_third_party_cookies_(false) {
+ block_third_party_cookies_(false),
+ is_off_the_record_(profile_->IsOffTheRecord()) {
PrefService* prefs = profile_->GetPrefs();
// Migrate obsolete cookie pref.
@@ -296,6 +297,12 @@ void HostContentSettingsMap::SetDefaultContentSetting(
DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
DictionaryValue* default_settings_dictionary =
profile_->GetPrefs()->GetMutableDictionary(
prefs::kDefaultContentSettings);
@@ -324,6 +331,12 @@ void HostContentSettingsMap::SetContentSetting(const Pattern& pattern,
DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
bool early_exit = false;
std::wstring wide_pattern(UTF8ToWide(pattern.AsString()));
DictionaryValue* all_settings_dictionary =
@@ -373,6 +386,13 @@ void HostContentSettingsMap::SetContentSetting(const Pattern& pattern,
void HostContentSettingsMap::ClearSettingsForOneType(
ContentSettingsType content_type) {
DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
+
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
{
AutoLock auto_lock(lock_);
for (HostContentSettings::iterator i(host_content_settings_.begin());
@@ -408,6 +428,12 @@ void HostContentSettingsMap::ClearSettingsForOneType(
void HostContentSettingsMap::SetBlockThirdPartyCookies(bool block) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
{
AutoLock auto_lock(lock_);
block_third_party_cookies_ = block;
@@ -439,6 +465,10 @@ void HostContentSettingsMap::ResetToDefaults() {
NotifyObservers(ContentSettingsDetails(true));
}
+bool HostContentSettingsMap::IsOffTheRecord() {
+ return profile_->IsOffTheRecord();
+}
+
HostContentSettingsMap::~HostContentSettingsMap() {
}
diff --git a/chrome/browser/host_content_settings_map.h b/chrome/browser/host_content_settings_map.h
index babc769..4107fb4 100644
--- a/chrome/browser/host_content_settings_map.h
+++ b/chrome/browser/host_content_settings_map.h
@@ -148,6 +148,9 @@ class HostContentSettingsMap
// This should only be called on the UI thread.
void ResetToDefaults();
+ // Whether this settings map is associated with an OTR session.
+ bool IsOffTheRecord();
+
private:
friend class base::RefCountedThreadSafe<HostContentSettingsMap>;
@@ -196,6 +199,9 @@ class HostContentSettingsMap
// Used around accesses to the settings objects to guarantee thread safety.
mutable Lock lock_;
+ // Whether this settings map is for an OTR session.
+ bool is_off_the_record_;
+
DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
};
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 652cedc..f1593ae 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -430,7 +430,12 @@ class OffTheRecordProfileImpl : public Profile,
}
virtual HostContentSettingsMap* GetHostContentSettingsMap() {
- return profile_->GetHostContentSettingsMap();
+ // Retrieve the host content settings map of the parent profile in order to
+ // ensure the preferences have been migrated.
+ profile_->GetHostContentSettingsMap();
+ if (!host_content_settings_map_.get())
+ host_content_settings_map_ = new HostContentSettingsMap(this);
+ return host_content_settings_map_.get();
}
virtual HostZoomMap* GetHostZoomMap() {
@@ -569,6 +574,9 @@ class OffTheRecordProfileImpl : public Profile,
// Use a separate desktop notification service for OTR.
scoped_ptr<DesktopNotificationService> desktop_notification_service_;
+ // We use a non-writable content settings map for OTR.
+ scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
+
// Use a special WebKit context for OTR browsing.
scoped_refptr<WebKitContext> webkit_context_;
diff --git a/chrome/browser/views/content_blocked_bubble_contents.cc b/chrome/browser/views/content_blocked_bubble_contents.cc
index e64d607..79c4bbe 100644
--- a/chrome/browser/views/content_blocked_bubble_contents.cc
+++ b/chrome/browser/views/content_blocked_bubble_contents.cc
@@ -223,6 +223,7 @@ void ContentSettingBubbleContents::InitControlLayout() {
views::RadioButton* radio = new views::RadioButton(
UTF8ToWide(*i), i - radio_group.radio_items.begin());
radio->set_listener(this);
+ radio->SetEnabled(radio_group.is_mutable);
radio_group_.push_back(radio);
layout->StartRow(0, single_column_set_id);
layout->AddView(radio);
diff --git a/chrome/browser/views/cookie_prompt_view.cc b/chrome/browser/views/cookie_prompt_view.cc
index b2b2a5f..32cbccb 100644
--- a/chrome/browser/views/cookie_prompt_view.cc
+++ b/chrome/browser/views/cookie_prompt_view.cc
@@ -148,12 +148,15 @@ void CookiePromptView::Init() {
IDS_COOKIE_ALERT_LABEL : IDS_DATA_ALERT_LABEL,
display_host));
int radio_group_id = 0;
+ bool remember_enabled = parent_->DecisionPersistable();
remember_radio_ = new views::RadioButton(
l10n_util::GetStringF(IDS_COOKIE_ALERT_REMEMBER_RADIO, display_host),
radio_group_id);
remember_radio_->set_listener(this);
+ remember_radio_->SetEnabled(remember_enabled);
ask_radio_ = new views::RadioButton(
l10n_util::GetString(IDS_COOKIE_ALERT_ASK_RADIO), radio_group_id);
+ ask_radio_->SetEnabled(remember_enabled);
ask_radio_->set_listener(this);
allow_button_ = new views::NativeButton(
this, l10n_util::GetString(IDS_COOKIE_ALERT_ALLOW_BUTTON));
@@ -260,7 +263,10 @@ void CookiePromptView::Init() {
info_view_->SetVisible(expanded_view_);
// Set default values.
- remember_radio_->SetChecked(true);
+ if (remember_enabled)
+ remember_radio_->SetChecked(true);
+ else
+ ask_radio_->SetChecked(true);
}
int CookiePromptView::GetExtendedViewHeight() {
@@ -294,4 +300,3 @@ void CookiePromptView::InitializeViewResources() {
IDS_COOKIE_ALERT_TITLE : IDS_DATA_ALERT_TITLE,
UTF8ToWide(parent_->origin().host()));
}
-