| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/content_settings/tab_specific_content_settings.h" | 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (settings) | 126 if (settings) |
| 127 settings->OnCookieChanged(url, frame_url, cookie_line, options, | 127 settings->OnCookieChanged(url, frame_url, cookie_line, options, |
| 128 blocked_by_policy); | 128 blocked_by_policy); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // static | 131 // static |
| 132 void TabSpecificContentSettings::WebDatabaseAccessed( | 132 void TabSpecificContentSettings::WebDatabaseAccessed( |
| 133 int render_process_id, | 133 int render_process_id, |
| 134 int render_view_id, | 134 int render_view_id, |
| 135 const GURL& url, | 135 const GURL& url, |
| 136 const string16& name, | 136 const base::string16& name, |
| 137 const string16& display_name, | 137 const base::string16& display_name, |
| 138 bool blocked_by_policy) { | 138 bool blocked_by_policy) { |
| 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 140 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); | 140 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); |
| 141 if (settings) | 141 if (settings) |
| 142 settings->OnWebDatabaseAccessed(url, name, display_name, blocked_by_policy); | 142 settings->OnWebDatabaseAccessed(url, name, display_name, blocked_by_policy); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // static | 145 // static |
| 146 void TabSpecificContentSettings::DOMStorageAccessed(int render_process_id, | 146 void TabSpecificContentSettings::DOMStorageAccessed(int render_process_id, |
| 147 int render_view_id, | 147 int render_view_id, |
| 148 const GURL& url, | 148 const GURL& url, |
| 149 bool local, | 149 bool local, |
| 150 bool blocked_by_policy) { | 150 bool blocked_by_policy) { |
| 151 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 151 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 152 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); | 152 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); |
| 153 if (settings) | 153 if (settings) |
| 154 settings->OnLocalStorageAccessed(url, local, blocked_by_policy); | 154 settings->OnLocalStorageAccessed(url, local, blocked_by_policy); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // static | 157 // static |
| 158 void TabSpecificContentSettings::IndexedDBAccessed(int render_process_id, | 158 void TabSpecificContentSettings::IndexedDBAccessed(int render_process_id, |
| 159 int render_view_id, | 159 int render_view_id, |
| 160 const GURL& url, | 160 const GURL& url, |
| 161 const string16& description, | 161 const base::string16& descrip
tion, |
| 162 bool blocked_by_policy) { | 162 bool blocked_by_policy) { |
| 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 164 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); | 164 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); |
| 165 if (settings) | 165 if (settings) |
| 166 settings->OnIndexedDBAccessed(url, description, blocked_by_policy); | 166 settings->OnIndexedDBAccessed(url, description, blocked_by_policy); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // static | 169 // static |
| 170 void TabSpecificContentSettings::FileSystemAccessed(int render_process_id, | 170 void TabSpecificContentSettings::FileSystemAccessed(int render_process_id, |
| 171 int render_view_id, | 171 int render_view_id, |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 allowed_local_shared_objects_.cookies()->AddChangedCookie( | 374 allowed_local_shared_objects_.cookies()->AddChangedCookie( |
| 375 frame_url, url, cookie_line, options); | 375 frame_url, url, cookie_line, options); |
| 376 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 376 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 377 } | 377 } |
| 378 | 378 |
| 379 NotifySiteDataObservers(); | 379 NotifySiteDataObservers(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 void TabSpecificContentSettings::OnIndexedDBAccessed( | 382 void TabSpecificContentSettings::OnIndexedDBAccessed( |
| 383 const GURL& url, | 383 const GURL& url, |
| 384 const string16& description, | 384 const base::string16& description, |
| 385 bool blocked_by_policy) { | 385 bool blocked_by_policy) { |
| 386 if (blocked_by_policy) { | 386 if (blocked_by_policy) { |
| 387 blocked_local_shared_objects_.indexed_dbs()->AddIndexedDB( | 387 blocked_local_shared_objects_.indexed_dbs()->AddIndexedDB( |
| 388 url, description); | 388 url, description); |
| 389 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 389 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
| 390 } else { | 390 } else { |
| 391 allowed_local_shared_objects_.indexed_dbs()->AddIndexedDB( | 391 allowed_local_shared_objects_.indexed_dbs()->AddIndexedDB( |
| 392 url, description); | 392 url, description); |
| 393 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 393 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 394 } | 394 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 409 if (blocked_by_policy) | 409 if (blocked_by_policy) |
| 410 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 410 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
| 411 else | 411 else |
| 412 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 412 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 413 | 413 |
| 414 NotifySiteDataObservers(); | 414 NotifySiteDataObservers(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void TabSpecificContentSettings::OnWebDatabaseAccessed( | 417 void TabSpecificContentSettings::OnWebDatabaseAccessed( |
| 418 const GURL& url, | 418 const GURL& url, |
| 419 const string16& name, | 419 const base::string16& name, |
| 420 const string16& display_name, | 420 const base::string16& display_name, |
| 421 bool blocked_by_policy) { | 421 bool blocked_by_policy) { |
| 422 if (blocked_by_policy) { | 422 if (blocked_by_policy) { |
| 423 blocked_local_shared_objects_.databases()->AddDatabase( | 423 blocked_local_shared_objects_.databases()->AddDatabase( |
| 424 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); | 424 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); |
| 425 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 425 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
| 426 } else { | 426 } else { |
| 427 allowed_local_shared_objects_.databases()->AddDatabase( | 427 allowed_local_shared_objects_.databases()->AddDatabase( |
| 428 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); | 428 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); |
| 429 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 429 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 430 } | 430 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 } | 720 } |
| 721 | 721 |
| 722 void TabSpecificContentSettings::RemoveSiteDataObserver( | 722 void TabSpecificContentSettings::RemoveSiteDataObserver( |
| 723 SiteDataObserver* observer) { | 723 SiteDataObserver* observer) { |
| 724 observer_list_.RemoveObserver(observer); | 724 observer_list_.RemoveObserver(observer); |
| 725 } | 725 } |
| 726 | 726 |
| 727 void TabSpecificContentSettings::NotifySiteDataObservers() { | 727 void TabSpecificContentSettings::NotifySiteDataObservers() { |
| 728 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 728 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
| 729 } | 729 } |
| OLD | NEW |