| 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/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/message_box_handler.h" | 9 #include "chrome/browser/message_box_handler.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 void DOMStoragePermissionRequest::PromptUser( | 30 void DOMStoragePermissionRequest::PromptUser( |
| 31 DOMStoragePermissionRequest* request) { | 31 DOMStoragePermissionRequest* request) { |
| 32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 33 | 33 |
| 34 // Cookie settings may have changed. | 34 // Cookie settings may have changed. |
| 35 ContentSetting setting = | 35 ContentSetting setting = |
| 36 request->host_content_settings_map_->GetContentSetting( | 36 request->host_content_settings_map_->GetContentSetting( |
| 37 request->url_, CONTENT_SETTINGS_TYPE_COOKIES); | 37 request->url_, CONTENT_SETTINGS_TYPE_COOKIES, ""); |
| 38 if (setting != CONTENT_SETTING_ASK) { | 38 if (setting != CONTENT_SETTING_ASK) { |
| 39 request->SendResponse(setting); | 39 request->SendResponse(setting); |
| 40 return; | 40 return; |
| 41 } | 41 } |
| 42 | 42 |
| 43 Browser* browser = BrowserList::GetLastActive(); | 43 Browser* browser = BrowserList::GetLastActive(); |
| 44 if (!browser || !browser->GetSelectedTabContents()) { | 44 if (!browser || !browser->GetSelectedTabContents()) { |
| 45 request->SendResponse(CONTENT_SETTING_BLOCK); | 45 request->SendResponse(CONTENT_SETTING_BLOCK); |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 | 48 |
| 49 RunLocalStoragePrompt(browser->GetSelectedTabContents(), | 49 RunLocalStoragePrompt(browser->GetSelectedTabContents(), |
| 50 request->host_content_settings_map_, request->url_, | 50 request->host_content_settings_map_, request->url_, |
| 51 request->key_, request->value_, request); | 51 request->key_, request->value_, request); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void DOMStoragePermissionRequest::AllowSiteData(bool session_expire) { | 54 void DOMStoragePermissionRequest::AllowSiteData(bool session_expire) { |
| 55 SendResponse(CONTENT_SETTING_ALLOW); | 55 SendResponse(CONTENT_SETTING_ALLOW); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void DOMStoragePermissionRequest::BlockSiteData() { | 58 void DOMStoragePermissionRequest::BlockSiteData() { |
| 59 SendResponse(CONTENT_SETTING_BLOCK); | 59 SendResponse(CONTENT_SETTING_BLOCK); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void DOMStoragePermissionRequest::SendResponse( | 62 void DOMStoragePermissionRequest::SendResponse( |
| 63 ContentSetting content_setting) { | 63 ContentSetting content_setting) { |
| 64 response_content_setting_ = content_setting; | 64 response_content_setting_ = content_setting; |
| 65 event_.Signal(); | 65 event_.Signal(); |
| 66 } | 66 } |
| OLD | NEW |