Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/in_process_webkit/dom_storage_permission_request.h" | 5 #include "chrome/browser/in_process_webkit/dom_storage_permission_request.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
| 8 #include "chrome/browser/message_box_handler.h" | 8 #include "chrome/browser/message_box_handler.h" |
| 9 | 9 |
| 10 DOMStoragePermissionRequest::DOMStoragePermissionRequest( | 10 DOMStoragePermissionRequest::DOMStoragePermissionRequest( |
| 11 const GURL& url, | 11 const GURL& url, |
| 12 bool file_exists, | 12 const string16& key, |
| 13 int64 size, | 13 const string16& value, |
| 14 base::Time last_modified, | |
| 15 HostContentSettingsMap* settings) | 14 HostContentSettingsMap* settings) |
| 16 : url_(url), | 15 : url_(url), |
| 17 file_exists_(file_exists), | 16 key_(key), |
| 18 size_(size), | 17 value_(value), |
| 19 last_modified_(last_modified), | |
| 20 event_(true, false), // manual reset, not initially signaled | 18 event_(true, false), // manual reset, not initially signaled |
| 21 host_content_settings_map_(settings) { | 19 host_content_settings_map_(settings) { |
| 22 } | 20 } |
| 23 | 21 |
| 24 ContentSetting DOMStoragePermissionRequest::WaitOnResponse() { | 22 ContentSetting DOMStoragePermissionRequest::WaitOnResponse() { |
| 25 event_.Wait(); | 23 event_.Wait(); |
| 26 return response_content_setting_; | 24 return response_content_setting_; |
| 27 } | 25 } |
| 28 | 26 |
| 29 void DOMStoragePermissionRequest::SendResponse(ContentSetting content_setting, | 27 void DOMStoragePermissionRequest::SendResponse(ContentSetting content_setting, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 55 if (!browser || !browser->GetSelectedTabContents()) { | 53 if (!browser || !browser->GetSelectedTabContents()) { |
| 56 dom_storage_permission_request->SendResponse(CONTENT_SETTING_BLOCK, false); | 54 dom_storage_permission_request->SendResponse(CONTENT_SETTING_BLOCK, false); |
| 57 return; | 55 return; |
| 58 } | 56 } |
| 59 | 57 |
| 60 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 61 // TODO(darin): It seems like it would be interesting if the dialog actually | 59 // TODO(darin): It seems like it would be interesting if the dialog actually |
| 62 // showed the name and value being stored (as is done for cookies). | 60 // showed the name and value being stored (as is done for cookies). |
| 63 const std::string& host = dom_storage_permission_request->url().host(); | 61 const std::string& host = dom_storage_permission_request->url().host(); |
| 64 RunLocalStoragePrompt(browser->GetSelectedTabContents(), | 62 RunLocalStoragePrompt(browser->GetSelectedTabContents(), |
| 65 BrowsingDataLocalStorageHelper::LocalStorageInfo( | 63 dom_storage_permission_request->url().host(), |
|
darin (slow to review)
2010/02/12 20:55:52
in http://codereview.chromium.org/597031, i actual
jorlow
2010/02/12 21:22:42
I'll switch it over to a GURL.
| |
| 66 std::string(), | 64 dom_storage_permission_request->key(), |
| 67 host, | 65 dom_storage_permission_request->value(), |
| 68 -1, | |
| 69 std::string(), | |
| 70 host, | |
| 71 FilePath(), | |
| 72 dom_storage_permission_request->size(), | |
| 73 dom_storage_permission_request->last_modified()), | |
| 74 dom_storage_permission_request); | 66 dom_storage_permission_request); |
| 75 #else | 67 #else |
| 76 // TODO(darin): Enable prompting for other ports. | 68 // TODO(darin): Enable prompting for other ports. |
| 77 dom_storage_permission_request->SendResponse(CONTENT_SETTING_BLOCK, false); | 69 dom_storage_permission_request->SendResponse(CONTENT_SETTING_BLOCK, false); |
| 78 #endif | 70 #endif |
| 79 } | 71 } |
| 80 | 72 |
| 81 void DOMStoragePermissionRequest::AllowSiteData(bool remember, | 73 void DOMStoragePermissionRequest::AllowSiteData(bool remember, |
| 82 bool session_expire) { | 74 bool session_expire) { |
| 83 // The session_expire parameter is not relevant. | 75 // The session_expire parameter is not relevant. |
| 84 SendResponse(CONTENT_SETTING_ALLOW, remember); | 76 SendResponse(CONTENT_SETTING_ALLOW, remember); |
| 85 } | 77 } |
| 86 | 78 |
| 87 void DOMStoragePermissionRequest::BlockSiteData(bool remember) { | 79 void DOMStoragePermissionRequest::BlockSiteData(bool remember) { |
| 88 SendResponse(CONTENT_SETTING_BLOCK, remember); | 80 SendResponse(CONTENT_SETTING_BLOCK, remember); |
| 89 } | 81 } |
| OLD | NEW |