| 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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "chrome/browser/content_settings/content_settings_usages_state.h" | 14 #include "chrome/browser/content_settings/content_settings_usages_state.h" |
| 15 #include "chrome/browser/content_settings/local_shared_objects_container.h" | 15 #include "chrome/browser/content_settings/local_shared_objects_container.h" |
| 16 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
| 16 #include "chrome/browser/media/media_stream_devices_controller.h" | 17 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 17 #include "chrome/common/content_settings.h" | 18 #include "chrome/common/content_settings.h" |
| 18 #include "chrome/common/content_settings_types.h" | 19 #include "chrome/common/content_settings_types.h" |
| 19 #include "chrome/common/custom_handlers/protocol_handler.h" | 20 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
| 23 #include "content/public/browser/web_contents_user_data.h" | 24 #include "content/public/browser/web_contents_user_data.h" |
| 24 #include "content/public/common/media_stream_request.h" | 25 #include "content/public/common/media_stream_request.h" |
| 25 #include "net/cookies/canonical_cookie.h" | 26 #include "net/cookies/canonical_cookie.h" |
| 26 | 27 |
| 27 class CookiesTreeModel; | 28 class CookiesTreeModel; |
| 28 class Profile; | 29 class Profile; |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 32 class RenderFrameHost; |
| 31 class RenderViewHost; | 33 class RenderViewHost; |
| 32 } | 34 } |
| 33 | 35 |
| 34 namespace net { | 36 namespace net { |
| 35 class CookieOptions; | 37 class CookieOptions; |
| 36 } | 38 } |
| 37 | 39 |
| 38 // This class manages state about permissions, content settings, cookies and | 40 // This class manages state about permissions, content settings, cookies and |
| 39 // site data for a specific WebContents. It tracks which content was accessed | 41 // site data for a specific WebContents. It tracks which content was accessed |
| 40 // and which content was blocked. Based on this it provides information about | 42 // and which content was blocked. Based on this it provides information about |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 154 |
| 153 // Called when a specific file system in the current page was accessed. | 155 // Called when a specific file system in the current page was accessed. |
| 154 // If access was blocked due to the user's content settings, | 156 // If access was blocked due to the user's content settings, |
| 155 // |blocked_by_policy| should be true, and this function should invoke | 157 // |blocked_by_policy| should be true, and this function should invoke |
| 156 // OnContentBlocked. | 158 // OnContentBlocked. |
| 157 static void FileSystemAccessed(int render_process_id, | 159 static void FileSystemAccessed(int render_process_id, |
| 158 int render_frame_id, | 160 int render_frame_id, |
| 159 const GURL& url, | 161 const GURL& url, |
| 160 bool blocked_by_policy); | 162 bool blocked_by_policy); |
| 161 | 163 |
| 164 // Called when a specific file system in the current page was accessed. |
| 165 // If access was blocked due to the user's content settings, |
| 166 // |blocked_by_policy| should be true, and this function should invoke |
| 167 // OnContentBlocked. |
| 168 static void FileSystemAccessedSyncDelayReply(int render_process_id, |
| 169 int render_frame_id, |
| 170 const GURL& url, |
| 171 IPC::Message* reply_msg, |
| 172 bool blocked_by_policy); |
| 173 |
| 174 // Called when a specific file system in the current page was accessed. |
| 175 // If access was blocked due to the user's content settings, |
| 176 // |blocked_by_policy| should be true, and this function should invoke |
| 177 // OnContentBlocked. |
| 178 static void FileSystemAccessedAsync(int render_process_id, |
| 179 int render_frame_id, |
| 180 int request_id, |
| 181 const GURL& url, |
| 182 bool blocked_by_policy); |
| 183 |
| 184 static void UpdateSettingsOnFileSystemAccessedDelayReply( |
| 185 int render_process_id, |
| 186 int render_frame_id, |
| 187 const GURL& url, |
| 188 IPC::Message* message, |
| 189 bool blocked_by_policy); |
| 190 |
| 162 // Resets the |content_blocked_| and |content_allowed_| arrays, except for | 191 // Resets the |content_blocked_| and |content_allowed_| arrays, except for |
| 163 // CONTENT_SETTINGS_TYPE_COOKIES related information. | 192 // CONTENT_SETTINGS_TYPE_COOKIES related information. |
| 164 void ClearBlockedContentSettingsExceptForCookies(); | 193 void ClearBlockedContentSettingsExceptForCookies(); |
| 165 | 194 |
| 166 // Resets all cookies related information. | 195 // Resets all cookies related information. |
| 167 void ClearCookieSpecificContentSettings(); | 196 void ClearCookieSpecificContentSettings(); |
| 168 | 197 |
| 169 // Clears the Geolocation settings. | 198 // Clears the Geolocation settings. |
| 170 void ClearGeolocationContentSettings(); | 199 void ClearGeolocationContentSettings(); |
| 171 | 200 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 friend class content::WebContentsUserData<TabSpecificContentSettings>; | 387 friend class content::WebContentsUserData<TabSpecificContentSettings>; |
| 359 | 388 |
| 360 // content::NotificationObserver implementation. | 389 // content::NotificationObserver implementation. |
| 361 virtual void Observe(int type, | 390 virtual void Observe(int type, |
| 362 const content::NotificationSource& source, | 391 const content::NotificationSource& source, |
| 363 const content::NotificationDetails& details) OVERRIDE; | 392 const content::NotificationDetails& details) OVERRIDE; |
| 364 | 393 |
| 365 // Notifies all registered |SiteDataObserver|s. | 394 // Notifies all registered |SiteDataObserver|s. |
| 366 void NotifySiteDataObservers(); | 395 void NotifySiteDataObservers(); |
| 367 | 396 |
| 397 static void FileSystemAccessedInternal(int render_process_id, |
| 398 int render_frame_id, |
| 399 int request_id, |
| 400 const GURL& url, |
| 401 bool blocked_by_policy); |
| 402 static WebViewGuest* GetWebViewGuest( |
| 403 content::RenderFrameHost* render_frame_host); |
| 404 static void FileSystemAccessedAsyncInternal(int render_process_id, |
| 405 int render_frame_id, |
| 406 int request_id, |
| 407 const GURL& url, |
| 408 bool blocked_by_policy); |
| 409 static void SendMessage(int render_process_id, |
| 410 int render_frame_id, |
| 411 int request_id, |
| 412 const GURL& url, |
| 413 bool blocked_by_policy); |
| 414 |
| 368 // All currently registered |SiteDataObserver|s. | 415 // All currently registered |SiteDataObserver|s. |
| 369 ObserverList<SiteDataObserver> observer_list_; | 416 ObserverList<SiteDataObserver> observer_list_; |
| 370 | 417 |
| 371 // Stores which content setting types actually have blocked content. | 418 // Stores which content setting types actually have blocked content. |
| 372 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES]; | 419 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES]; |
| 373 | 420 |
| 374 // Stores if the blocked content was messaged to the user. | 421 // Stores if the blocked content was messaged to the user. |
| 375 bool content_blockage_indicated_to_user_[CONTENT_SETTINGS_NUM_TYPES]; | 422 bool content_blockage_indicated_to_user_[CONTENT_SETTINGS_NUM_TYPES]; |
| 376 | 423 |
| 377 // Stores which content setting types actually were allowed. | 424 // Stores which content setting types actually were allowed. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 464 |
| 418 // The devices to be displayed in the media bubble when the media stream | 465 // The devices to be displayed in the media bubble when the media stream |
| 419 // request is requesting certain specific devices. | 466 // request is requesting certain specific devices. |
| 420 std::string media_stream_requested_audio_device_; | 467 std::string media_stream_requested_audio_device_; |
| 421 std::string media_stream_requested_video_device_; | 468 std::string media_stream_requested_video_device_; |
| 422 | 469 |
| 423 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 470 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
| 424 }; | 471 }; |
| 425 | 472 |
| 426 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 473 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| OLD | NEW |