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

Unified Diff: chrome/browser/renderer_host/database_permission_request.cc

Issue 3299020: Remove vestigial cookie/web app permissions prompting UI now that the async U... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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/renderer_host/database_permission_request.cc
===================================================================
--- chrome/browser/renderer_host/database_permission_request.cc (revision 59533)
+++ chrome/browser/renderer_host/database_permission_request.cc (working copy)
@@ -1,90 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/renderer_host/database_permission_request.h"
-
-
-#include "chrome/browser/browser_list.h"
-#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/host_content_settings_map.h"
-#include "chrome/browser/message_box_handler.h"
-
-DatabasePermissionRequest::DatabasePermissionRequest(
- const GURL& url,
- const string16& database_name,
- const string16& display_name,
- unsigned long estimated_size,
- Task* on_allow,
- Task* on_block,
- HostContentSettingsMap* settings_map)
- : url_(url),
- database_name_(database_name),
- display_name_(display_name),
- estimated_size_(estimated_size),
- on_allow_(on_allow),
- on_block_(on_block),
- host_content_settings_map_(settings_map) {
- DCHECK(on_allow_.get());
- DCHECK(on_block_.get());
-}
-
-DatabasePermissionRequest::~DatabasePermissionRequest() {
-}
-
-void DatabasePermissionRequest::RequestPermission() {
- if (ChromeThread::CurrentlyOn(ChromeThread::IO)) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE, NewRunnableMethod(
- this, &DatabasePermissionRequest::RequestPermission));
- return;
- }
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
-
- // Cookie settings may have changed.
- ContentSetting setting = host_content_settings_map_->GetContentSetting(
- url_, CONTENT_SETTINGS_TYPE_COOKIES, "");
- if (setting != CONTENT_SETTING_ASK) {
- SendResponse(setting);
- return;
- }
-
- Browser* browser = BrowserList::GetLastActive();
- if (!browser || !browser->GetSelectedTabContents()) {
- BlockSiteData();
- return;
- }
-
- self_ref_ = this;
- // Will call either AllowSiteData or BlockSiteData which will NULL out our
- // self reference.
- RunDatabasePrompt(browser->GetSelectedTabContents(),
- host_content_settings_map_, url_, database_name_,
- display_name_, estimated_size_, this);
-}
-
-void DatabasePermissionRequest::AllowSiteData(bool session_expire) {
- SendResponse(CONTENT_SETTING_ALLOW);
-}
-
-void DatabasePermissionRequest::BlockSiteData() {
- SendResponse(CONTENT_SETTING_BLOCK);
-}
-
-void DatabasePermissionRequest::SendResponse(ContentSetting content_setting) {
- if (content_setting == CONTENT_SETTING_ALLOW) {
- ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, on_allow_.release());
- } else {
- DCHECK(content_setting == CONTENT_SETTING_BLOCK);
- ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, on_block_.release());
- }
-
- // Release all resources.
- on_allow_.reset();
- on_block_.reset();
-
- // This seems safer than possibly being deleted while in method(s) related to
- // this object. Any thread will do, but UI is always around and can be
- // posted without locking, so we'll ask it to do the release.
- ChromeThread::ReleaseSoon(ChromeThread::UI, FROM_HERE, self_ref_.release());
-}

Powered by Google App Engine
This is Rietveld 408576698