diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 03:51:50 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 03:51:50 +0000 |
commit | 1e1baa489c6fc202c8516707dd5ca2d4738920b9 (patch) | |
tree | 060270c7656e935cfdb0aaa1cea4d48cc8626611 /chrome/browser/views/cookie_prompt_view.cc | |
parent | c1f50aa589d83b9725d4b7f19559eb94c006d818 (diff) | |
download | chromium_src-1e1baa489c6fc202c8516707dd5ca2d4738920b9.zip chromium_src-1e1baa489c6fc202c8516707dd5ca2d4738920b9.tar.gz chromium_src-1e1baa489c6fc202c8516707dd5ca2d4738920b9.tar.bz2 |
Fixes two bugs in cookie prompting:
. In certain situations we could crash because we weren't letting
CookiePromptView::Init complete and then attempting to reference
some NULL fields. I've fixed this by adding AppModalDialog::IsValid
and moving the logic that was in Init to IsValid. This way we only create
CookiePromptView when needed.
. We were leaking AppModalDialogs. I've made CookiePromptView own the
AppModalDialog and delete it when the CookiePromptView is deleted.
BUG=36079
TEST=enable prompting for cookies, go to a bunch of sites make sure
you don't crash.
Review URL: http://codereview.chromium.org/632006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/cookie_prompt_view.cc')
-rw-r--r-- | chrome/browser/views/cookie_prompt_view.cc | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/chrome/browser/views/cookie_prompt_view.cc b/chrome/browser/views/cookie_prompt_view.cc index 6cc526a..0cd93da 100644 --- a/chrome/browser/views/cookie_prompt_view.cc +++ b/chrome/browser/views/cookie_prompt_view.cc @@ -14,9 +14,7 @@ #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/cookie_modal_dialog.h" -#include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/views/browser_dialogs.h" #include "chrome/browser/views/cookie_info_view.h" #include "chrome/browser/views/database_open_info_view.h" @@ -61,6 +59,7 @@ CookiePromptView::CookiePromptView( } CookiePromptView::~CookiePromptView() { + delete parent_; } /////////////////////////////////////////////////////////////////////////////// @@ -137,24 +136,6 @@ void CookiePromptView::LinkActivated(views::Link* source, int event_flags) { // CookiePromptView, private: void CookiePromptView::Init() { - // See if there's still a need for this dialog. Self destruct if not. - HostContentSettingsMap* host_content_settings_map = - parent_->tab_contents()->profile()->GetHostContentSettingsMap(); - ContentSetting content_setting = - host_content_settings_map->GetContentSetting( - parent_->origin(), CONTENT_SETTINGS_TYPE_COOKIES); - if (content_setting != CONTENT_SETTING_ASK) { - if (content_setting == CONTENT_SETTING_ALLOW) { - parent_->AllowSiteData(false, false); - } else { - DCHECK(content_setting == CONTENT_SETTING_BLOCK); - parent_->BlockSiteData(false); - } - signaled_ = true; - GetWindow()->Close(); - return; - } - CookiePromptModalDialog::DialogType type = parent_->dialog_type(); std::wstring display_host = UTF8ToWide(parent_->origin().host()); views::Label* description_label = new views::Label(l10n_util::GetStringF( |