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

Unified Diff: chrome/browser/in_process_webkit/dom_storage_area.cc

Issue 597061: Make the setItem CONTENT_SETTING_ASK dialog more useful by showing the actual... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 10 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/in_process_webkit/dom_storage_area.cc
===================================================================
--- chrome/browser/in_process_webkit/dom_storage_area.cc (revision 38896)
+++ chrome/browser/in_process_webkit/dom_storage_area.cc (working copy)
@@ -42,32 +42,23 @@
}
unsigned DOMStorageArea::Length() {
- if (!CheckContentSetting())
- return 0; // Pretend we're an empty store.
-
CreateWebStorageAreaIfNecessary();
return storage_area_->length();
}
NullableString16 DOMStorageArea::Key(unsigned index) {
- if (!CheckContentSetting())
- return NullableString16(true); // Null string.
-
CreateWebStorageAreaIfNecessary();
return storage_area_->key(index);
}
NullableString16 DOMStorageArea::GetItem(const string16& key) {
- if (!CheckContentSetting())
- return NullableString16(true); // Null string.
-
CreateWebStorageAreaIfNecessary();
return storage_area_->getItem(key);
}
NullableString16 DOMStorageArea::SetItem(
const string16& key, const string16& value, bool* quota_exception) {
- if (!CheckContentSetting()) {
+ if (!CheckContentSetting(key, value)) {
*quota_exception = true;
return NullableString16(true); // Ignored if exception is true.
}
@@ -79,9 +70,6 @@
}
NullableString16 DOMStorageArea::RemoveItem(const string16& key) {
- if (!CheckContentSetting())
- return NullableString16(true); // Indicates nothing removed.
-
CreateWebStorageAreaIfNecessary();
WebString old_value;
storage_area_->removeItem(key, WebURL(), old_value);
@@ -89,9 +77,6 @@
}
bool DOMStorageArea::Clear() {
- if (!CheckContentSetting())
- return false; // Nothing cleared.
-
CreateWebStorageAreaIfNecessary();
bool somethingCleared;
storage_area_->clear(WebURL(), somethingCleared);
@@ -107,31 +92,14 @@
storage_area_.reset(owner_->CreateWebStorageArea(origin_));
}
-bool DOMStorageArea::CheckContentSetting() {
+bool DOMStorageArea::CheckContentSetting(const string16& key,
+ const string16& value) {
ContentSetting content_setting =
host_content_settings_map_->GetContentSetting(
origin_url_, CONTENT_SETTINGS_TYPE_COOKIES);
if (content_setting == CONTENT_SETTING_ASK) {
- WebSecurityOrigin security_origin(
- WebSecurityOrigin::createFromString(origin_));
- FilePath::StringType file_name = webkit_glue::WebStringToFilePath(
- security_origin.databaseIdentifier()).value();
- file_name.append(DOMStorageContext::kLocalStorageExtension);
- FilePath file_path = webkit_glue::WebStringToFilePath(
- owner_->data_dir_path()).Append(file_name);
-
- bool file_exists = false;
- int64 size = 0;
- base::Time last_modified;
- file_util::FileInfo file_info;
- if (file_util::GetFileInfo(file_path, &file_info)) {
- file_exists = true;
- size = file_info.size;
- last_modified = file_info.last_modified;
- }
- DOMStoragePermissionRequest request(origin_url_, file_exists, size,
- last_modified,
+ DOMStoragePermissionRequest request(origin_url_, key, value,
host_content_settings_map_);
ChromeThread::PostTask(
ChromeThread::UI, FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698