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

Side by Side Diff: chrome/browser/in_process_webkit/dom_storage_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/in_process_webkit/dom_storage_permission_request.h"
6
7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/message_box_handler.h"
10
11 DOMStoragePermissionRequest::DOMStoragePermissionRequest(
12 const GURL& url,
13 const string16& key,
14 const string16& value,
15 HostContentSettingsMap* settings)
16 : url_(url),
17 key_(key),
18 value_(value),
19 response_content_setting_(CONTENT_SETTING_DEFAULT),
20 event_(true, false), // manual reset, not initially signaled
21 host_content_settings_map_(settings) {
22 }
23
24 ContentSetting DOMStoragePermissionRequest::WaitOnResponse() {
25 event_.Wait();
26 return response_content_setting_;
27 }
28
29 // static
30 void DOMStoragePermissionRequest::PromptUser(
31 DOMStoragePermissionRequest* request) {
32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
33
34 // Cookie settings may have changed.
35 ContentSetting setting =
36 request->host_content_settings_map_->GetContentSetting(
37 request->url_, CONTENT_SETTINGS_TYPE_COOKIES, "");
38 if (setting != CONTENT_SETTING_ASK) {
39 request->SendResponse(setting);
40 return;
41 }
42
43 Browser* browser = BrowserList::GetLastActive();
44 if (!browser || !browser->GetSelectedTabContents()) {
45 request->SendResponse(CONTENT_SETTING_BLOCK);
46 return;
47 }
48
49 RunLocalStoragePrompt(browser->GetSelectedTabContents(),
50 request->host_content_settings_map_, request->url_,
51 request->key_, request->value_, request);
52 }
53
54 void DOMStoragePermissionRequest::AllowSiteData(bool session_expire) {
55 SendResponse(CONTENT_SETTING_ALLOW);
56 }
57
58 void DOMStoragePermissionRequest::BlockSiteData() {
59 SendResponse(CONTENT_SETTING_BLOCK);
60 }
61
62 void DOMStoragePermissionRequest::SendResponse(
63 ContentSetting content_setting) {
64 response_content_setting_ = content_setting;
65 event_.Signal();
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698