| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 TabSpecificContentSettings::BlockedResourcesForType( | 234 TabSpecificContentSettings::BlockedResourcesForType( |
| 235 ContentSettingsType content_type) const { | 235 ContentSettingsType content_type) const { |
| 236 if (blocked_resources_[content_type].get()) { | 236 if (blocked_resources_[content_type].get()) { |
| 237 return *blocked_resources_[content_type]; | 237 return *blocked_resources_[content_type]; |
| 238 } else { | 238 } else { |
| 239 CR_DEFINE_STATIC_LOCAL(std::set<std::string>, empty_set, ()); | 239 CR_DEFINE_STATIC_LOCAL(std::set<std::string>, empty_set, ()); |
| 240 return empty_set; | 240 return empty_set; |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 void TabSpecificContentSettings::AddBlockedResource( | 244 void TabSpecificContentSettings::OnContentBlocked(ContentSettingsType type) { |
| 245 ContentSettingsType content_type, | |
| 246 const std::string& resource_identifier) { | |
| 247 if (!blocked_resources_[content_type].get()) | |
| 248 blocked_resources_[content_type].reset(new std::set<std::string>()); | |
| 249 blocked_resources_[content_type]->insert(resource_identifier); | |
| 250 } | |
| 251 | |
| 252 void TabSpecificContentSettings::OnContentBlocked( | |
| 253 ContentSettingsType type, | |
| 254 const std::string& resource_identifier) { | |
| 255 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) | 245 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| 256 << "Geolocation settings handled by OnGeolocationPermissionSet"; | 246 << "Geolocation settings handled by OnGeolocationPermissionSet"; |
| 257 if (type < 0 || type >= CONTENT_SETTINGS_NUM_TYPES) | 247 if (type < 0 || type >= CONTENT_SETTINGS_NUM_TYPES) |
| 258 return; | 248 return; |
| 259 | 249 |
| 260 // Media is different from other content setting types since it allows new | 250 // Media is different from other content setting types since it allows new |
| 261 // setting to kick in without reloading the page, and the UI for media is | 251 // setting to kick in without reloading the page, and the UI for media is |
| 262 // always reflecting the newest permission setting. | 252 // always reflecting the newest permission setting. |
| 263 switch (type) { | 253 switch (type) { |
| 264 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | 254 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: |
| 265 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | 255 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: |
| 266 #if defined(OS_ANDROID) | 256 #if defined(OS_ANDROID) |
| 267 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 257 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 268 #endif | 258 #endif |
| 269 content_allowed_[type] = false; | 259 content_allowed_[type] = false; |
| 270 break; | 260 break; |
| 271 default: | 261 default: |
| 272 content_allowed_[type] = true; | 262 content_allowed_[type] = true; |
| 273 break; | 263 break; |
| 274 } | 264 } |
| 275 | 265 |
| 276 // Unless UI for resource content settings is enabled, ignore the resource | |
| 277 // identifier. | |
| 278 // TODO(bauerb): The UI to unblock content should be disabled if the content | |
| 279 // setting was not set by the user. | |
| 280 std::string identifier; | |
| 281 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 282 switches::kEnableResourceContentSettings)) { | |
| 283 identifier = resource_identifier; | |
| 284 } | |
| 285 if (!identifier.empty()) | |
| 286 AddBlockedResource(type, identifier); | |
| 287 | |
| 288 #if defined(OS_ANDROID) | 266 #if defined(OS_ANDROID) |
| 289 if (type == CONTENT_SETTINGS_TYPE_POPUPS) { | 267 if (type == CONTENT_SETTINGS_TYPE_POPUPS) { |
| 290 // For Android we do not have a persistent button that will always be | 268 // For Android we do not have a persistent button that will always be |
| 291 // visible for blocked popups. Instead we have info bars which could be | 269 // visible for blocked popups. Instead we have info bars which could be |
| 292 // dismissed. Have to clear the blocked state so we properly notify the | 270 // dismissed. Have to clear the blocked state so we properly notify the |
| 293 // relevant pieces again. | 271 // relevant pieces again. |
| 294 content_blocked_[type] = false; | 272 content_blocked_[type] = false; |
| 295 content_blockage_indicated_to_user_[type] = false; | 273 content_blockage_indicated_to_user_[type] = false; |
| 296 } | 274 } |
| 297 #endif | 275 #endif |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 void TabSpecificContentSettings::OnCookiesRead( | 321 void TabSpecificContentSettings::OnCookiesRead( |
| 344 const GURL& url, | 322 const GURL& url, |
| 345 const GURL& frame_url, | 323 const GURL& frame_url, |
| 346 const net::CookieList& cookie_list, | 324 const net::CookieList& cookie_list, |
| 347 bool blocked_by_policy) { | 325 bool blocked_by_policy) { |
| 348 if (cookie_list.empty()) | 326 if (cookie_list.empty()) |
| 349 return; | 327 return; |
| 350 if (blocked_by_policy) { | 328 if (blocked_by_policy) { |
| 351 blocked_local_shared_objects_.cookies()->AddReadCookies( | 329 blocked_local_shared_objects_.cookies()->AddReadCookies( |
| 352 frame_url, url, cookie_list); | 330 frame_url, url, cookie_list); |
| 353 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 331 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 354 } else { | 332 } else { |
| 355 allowed_local_shared_objects_.cookies()->AddReadCookies( | 333 allowed_local_shared_objects_.cookies()->AddReadCookies( |
| 356 frame_url, url, cookie_list); | 334 frame_url, url, cookie_list); |
| 357 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 335 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 358 } | 336 } |
| 359 | 337 |
| 360 NotifySiteDataObservers(); | 338 NotifySiteDataObservers(); |
| 361 } | 339 } |
| 362 | 340 |
| 363 void TabSpecificContentSettings::OnCookieChanged( | 341 void TabSpecificContentSettings::OnCookieChanged( |
| 364 const GURL& url, | 342 const GURL& url, |
| 365 const GURL& frame_url, | 343 const GURL& frame_url, |
| 366 const std::string& cookie_line, | 344 const std::string& cookie_line, |
| 367 const net::CookieOptions& options, | 345 const net::CookieOptions& options, |
| 368 bool blocked_by_policy) { | 346 bool blocked_by_policy) { |
| 369 if (blocked_by_policy) { | 347 if (blocked_by_policy) { |
| 370 blocked_local_shared_objects_.cookies()->AddChangedCookie( | 348 blocked_local_shared_objects_.cookies()->AddChangedCookie( |
| 371 frame_url, url, cookie_line, options); | 349 frame_url, url, cookie_line, options); |
| 372 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 350 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 373 } else { | 351 } else { |
| 374 allowed_local_shared_objects_.cookies()->AddChangedCookie( | 352 allowed_local_shared_objects_.cookies()->AddChangedCookie( |
| 375 frame_url, url, cookie_line, options); | 353 frame_url, url, cookie_line, options); |
| 376 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 354 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 377 } | 355 } |
| 378 | 356 |
| 379 NotifySiteDataObservers(); | 357 NotifySiteDataObservers(); |
| 380 } | 358 } |
| 381 | 359 |
| 382 void TabSpecificContentSettings::OnIndexedDBAccessed( | 360 void TabSpecificContentSettings::OnIndexedDBAccessed( |
| 383 const GURL& url, | 361 const GURL& url, |
| 384 const base::string16& description, | 362 const base::string16& description, |
| 385 bool blocked_by_policy) { | 363 bool blocked_by_policy) { |
| 386 if (blocked_by_policy) { | 364 if (blocked_by_policy) { |
| 387 blocked_local_shared_objects_.indexed_dbs()->AddIndexedDB( | 365 blocked_local_shared_objects_.indexed_dbs()->AddIndexedDB( |
| 388 url, description); | 366 url, description); |
| 389 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 367 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 390 } else { | 368 } else { |
| 391 allowed_local_shared_objects_.indexed_dbs()->AddIndexedDB( | 369 allowed_local_shared_objects_.indexed_dbs()->AddIndexedDB( |
| 392 url, description); | 370 url, description); |
| 393 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 371 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 394 } | 372 } |
| 395 | 373 |
| 396 NotifySiteDataObservers(); | 374 NotifySiteDataObservers(); |
| 397 } | 375 } |
| 398 | 376 |
| 399 void TabSpecificContentSettings::OnLocalStorageAccessed( | 377 void TabSpecificContentSettings::OnLocalStorageAccessed( |
| 400 const GURL& url, | 378 const GURL& url, |
| 401 bool local, | 379 bool local, |
| 402 bool blocked_by_policy) { | 380 bool blocked_by_policy) { |
| 403 LocalSharedObjectsContainer& container = blocked_by_policy ? | 381 LocalSharedObjectsContainer& container = blocked_by_policy ? |
| 404 blocked_local_shared_objects_ : allowed_local_shared_objects_; | 382 blocked_local_shared_objects_ : allowed_local_shared_objects_; |
| 405 CannedBrowsingDataLocalStorageHelper* helper = | 383 CannedBrowsingDataLocalStorageHelper* helper = |
| 406 local ? container.local_storages() : container.session_storages(); | 384 local ? container.local_storages() : container.session_storages(); |
| 407 helper->AddLocalStorage(url); | 385 helper->AddLocalStorage(url); |
| 408 | 386 |
| 409 if (blocked_by_policy) | 387 if (blocked_by_policy) |
| 410 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 388 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 411 else | 389 else |
| 412 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 390 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 413 | 391 |
| 414 NotifySiteDataObservers(); | 392 NotifySiteDataObservers(); |
| 415 } | 393 } |
| 416 | 394 |
| 417 void TabSpecificContentSettings::OnWebDatabaseAccessed( | 395 void TabSpecificContentSettings::OnWebDatabaseAccessed( |
| 418 const GURL& url, | 396 const GURL& url, |
| 419 const base::string16& name, | 397 const base::string16& name, |
| 420 const base::string16& display_name, | 398 const base::string16& display_name, |
| 421 bool blocked_by_policy) { | 399 bool blocked_by_policy) { |
| 422 if (blocked_by_policy) { | 400 if (blocked_by_policy) { |
| 423 blocked_local_shared_objects_.databases()->AddDatabase( | 401 blocked_local_shared_objects_.databases()->AddDatabase( |
| 424 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); | 402 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); |
| 425 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 403 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 426 } else { | 404 } else { |
| 427 allowed_local_shared_objects_.databases()->AddDatabase( | 405 allowed_local_shared_objects_.databases()->AddDatabase( |
| 428 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); | 406 url, UTF16ToUTF8(name), UTF16ToUTF8(display_name)); |
| 429 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 407 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 430 } | 408 } |
| 431 | 409 |
| 432 NotifySiteDataObservers(); | 410 NotifySiteDataObservers(); |
| 433 } | 411 } |
| 434 | 412 |
| 435 void TabSpecificContentSettings::OnFileSystemAccessed( | 413 void TabSpecificContentSettings::OnFileSystemAccessed( |
| 436 const GURL& url, | 414 const GURL& url, |
| 437 bool blocked_by_policy) { | 415 bool blocked_by_policy) { |
| 438 if (blocked_by_policy) { | 416 if (blocked_by_policy) { |
| 439 blocked_local_shared_objects_.file_systems()->AddFileSystem(url, | 417 blocked_local_shared_objects_.file_systems()->AddFileSystem(url, |
| 440 fileapi::kFileSystemTypeTemporary, 0); | 418 fileapi::kFileSystemTypeTemporary, 0); |
| 441 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 419 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 442 } else { | 420 } else { |
| 443 allowed_local_shared_objects_.file_systems()->AddFileSystem(url, | 421 allowed_local_shared_objects_.file_systems()->AddFileSystem(url, |
| 444 fileapi::kFileSystemTypeTemporary, 0); | 422 fileapi::kFileSystemTypeTemporary, 0); |
| 445 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 423 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 446 } | 424 } |
| 447 | 425 |
| 448 NotifySiteDataObservers(); | 426 NotifySiteDataObservers(); |
| 449 } | 427 } |
| 450 | 428 |
| 451 void TabSpecificContentSettings::OnGeolocationPermissionSet( | 429 void TabSpecificContentSettings::OnGeolocationPermissionSet( |
| 452 const GURL& requesting_origin, | 430 const GURL& requesting_origin, |
| 453 bool allowed) { | 431 bool allowed) { |
| 454 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); | 432 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed); |
| 455 content::NotificationService::current()->Notify( | 433 content::NotificationService::current()->Notify( |
| 456 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 434 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
| 457 content::Source<WebContents>(web_contents()), | 435 content::Source<WebContents>(web_contents()), |
| 458 content::NotificationService::NoDetails()); | 436 content::NotificationService::NoDetails()); |
| 459 } | 437 } |
| 460 | 438 |
| 461 #if defined(OS_ANDROID) | 439 #if defined(OS_ANDROID) |
| 462 void TabSpecificContentSettings::OnProtectedMediaIdentifierPermissionSet( | 440 void TabSpecificContentSettings::OnProtectedMediaIdentifierPermissionSet( |
| 463 const GURL& requesting_origin, | 441 const GURL& requesting_origin, |
| 464 bool allowed) { | 442 bool allowed) { |
| 465 if (allowed) { | 443 if (allowed) { |
| 466 OnContentAllowed(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); | 444 OnContentAllowed(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); |
| 467 } else { | 445 } else { |
| 468 OnContentBlocked(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 446 OnContentBlocked(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); |
| 469 std::string()); | |
| 470 } | 447 } |
| 471 } | 448 } |
| 472 #endif | 449 #endif |
| 473 | 450 |
| 474 TabSpecificContentSettings::MicrophoneCameraState | 451 TabSpecificContentSettings::MicrophoneCameraState |
| 475 TabSpecificContentSettings::GetMicrophoneCameraState() const { | 452 TabSpecificContentSettings::GetMicrophoneCameraState() const { |
| 476 if (IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && | 453 if (IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && |
| 477 IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)) { | 454 IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)) { |
| 478 return MICROPHONE_CAMERA_ACCESSED; | 455 return MICROPHONE_CAMERA_ACCESSED; |
| 479 } else if (IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)) { | 456 } else if (IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 508 case MediaStreamDevicesController::MEDIA_NONE: | 485 case MediaStreamDevicesController::MEDIA_NONE: |
| 509 NOTREACHED(); | 486 NOTREACHED(); |
| 510 break; | 487 break; |
| 511 case MediaStreamDevicesController::MEDIA_ALLOWED: | 488 case MediaStreamDevicesController::MEDIA_ALLOWED: |
| 512 OnContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 489 OnContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 513 break; | 490 break; |
| 514 // TODO(grunell): UI should show for what reason access has been blocked. | 491 // TODO(grunell): UI should show for what reason access has been blocked. |
| 515 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_POLICY: | 492 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_POLICY: |
| 516 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER_SETTING: | 493 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER_SETTING: |
| 517 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER: | 494 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER: |
| 518 OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 495 OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 519 std::string()); | |
| 520 break; | 496 break; |
| 521 } | 497 } |
| 522 } | 498 } |
| 523 | 499 |
| 524 it = request_permissions.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); | 500 it = request_permissions.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); |
| 525 if (it != request_permissions.end()) { | 501 if (it != request_permissions.end()) { |
| 526 media_stream_requested_video_device_ = it->second.requested_device_id; | 502 media_stream_requested_video_device_ = it->second.requested_device_id; |
| 527 switch (it->second.permission) { | 503 switch (it->second.permission) { |
| 528 case MediaStreamDevicesController::MEDIA_NONE: | 504 case MediaStreamDevicesController::MEDIA_NONE: |
| 529 NOTREACHED(); | 505 NOTREACHED(); |
| 530 break; | 506 break; |
| 531 case MediaStreamDevicesController::MEDIA_ALLOWED: | 507 case MediaStreamDevicesController::MEDIA_ALLOWED: |
| 532 OnContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 508 OnContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 533 break; | 509 break; |
| 534 // TODO(grunell): UI should show for what reason access has been blocked. | 510 // TODO(grunell): UI should show for what reason access has been blocked. |
| 535 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_POLICY: | 511 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_POLICY: |
| 536 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER_SETTING: | 512 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER_SETTING: |
| 537 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER: | 513 case MediaStreamDevicesController::MEDIA_BLOCKED_BY_USER: |
| 538 OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 514 OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 539 std::string()); | |
| 540 break; | 515 break; |
| 541 } | 516 } |
| 542 } | 517 } |
| 543 } | 518 } |
| 544 | 519 |
| 545 void TabSpecificContentSettings::OnMIDISysExAccessed( | 520 void TabSpecificContentSettings::OnMIDISysExAccessed( |
| 546 const GURL& requesting_origin) { | 521 const GURL& requesting_origin) { |
| 547 midi_usages_state_.OnPermissionSet(requesting_origin, true); | 522 midi_usages_state_.OnPermissionSet(requesting_origin, true); |
| 548 OnContentAllowed(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); | 523 OnContentAllowed(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
| 549 } | 524 } |
| 550 | 525 |
| 551 void TabSpecificContentSettings::OnMIDISysExAccessBlocked( | 526 void TabSpecificContentSettings::OnMIDISysExAccessBlocked( |
| 552 const GURL& requesting_origin) { | 527 const GURL& requesting_origin) { |
| 553 midi_usages_state_.OnPermissionSet(requesting_origin, false); | 528 midi_usages_state_.OnPermissionSet(requesting_origin, false); |
| 554 OnContentBlocked(CONTENT_SETTINGS_TYPE_MIDI_SYSEX, std::string()); | 529 OnContentBlocked(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
| 555 } | 530 } |
| 556 | 531 |
| 557 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { | 532 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { |
| 558 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { | 533 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { |
| 559 if (i == CONTENT_SETTINGS_TYPE_COOKIES) | 534 if (i == CONTENT_SETTINGS_TYPE_COOKIES) |
| 560 continue; | 535 continue; |
| 561 blocked_resources_[i].reset(); | 536 blocked_resources_[i].reset(); |
| 562 content_blocked_[i] = false; | 537 content_blocked_[i] = false; |
| 563 content_allowed_[i] = false; | 538 content_allowed_[i] = false; |
| 564 content_blockage_indicated_to_user_[i] = false; | 539 content_blockage_indicated_to_user_[i] = false; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 592 } |
| 618 | 593 |
| 619 void TabSpecificContentSettings::ClearMIDIContentSettings() { | 594 void TabSpecificContentSettings::ClearMIDIContentSettings() { |
| 620 midi_usages_state_.ClearStateMap(); | 595 midi_usages_state_.ClearStateMap(); |
| 621 } | 596 } |
| 622 | 597 |
| 623 void TabSpecificContentSettings::SetPepperBrokerAllowed(bool allowed) { | 598 void TabSpecificContentSettings::SetPepperBrokerAllowed(bool allowed) { |
| 624 if (allowed) { | 599 if (allowed) { |
| 625 OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); | 600 OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
| 626 } else { | 601 } else { |
| 627 OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()); | 602 OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
| 628 } | 603 } |
| 629 } | 604 } |
| 630 | 605 |
| 631 void TabSpecificContentSettings::RenderViewForInterstitialPageCreated( | 606 void TabSpecificContentSettings::RenderViewForInterstitialPageCreated( |
| 632 RenderViewHost* render_view_host) { | 607 RenderViewHost* render_view_host) { |
| 633 // We want to tell the renderer-side code to ignore content settings for this | 608 // We want to tell the renderer-side code to ignore content settings for this |
| 634 // page. | 609 // page. |
| 635 render_view_host->Send(new ChromeViewMsg_SetAsInterstitial( | 610 render_view_host->Send(new ChromeViewMsg_SetAsInterstitial( |
| 636 render_view_host->GetRoutingID())); | 611 render_view_host->GetRoutingID())); |
| 637 } | 612 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 ClearCookieSpecificContentSettings(); | 650 ClearCookieSpecificContentSettings(); |
| 676 ClearGeolocationContentSettings(); | 651 ClearGeolocationContentSettings(); |
| 677 ClearMIDIContentSettings(); | 652 ClearMIDIContentSettings(); |
| 678 ClearPendingProtocolHandler(); | 653 ClearPendingProtocolHandler(); |
| 679 } | 654 } |
| 680 | 655 |
| 681 void TabSpecificContentSettings::AppCacheAccessed(const GURL& manifest_url, | 656 void TabSpecificContentSettings::AppCacheAccessed(const GURL& manifest_url, |
| 682 bool blocked_by_policy) { | 657 bool blocked_by_policy) { |
| 683 if (blocked_by_policy) { | 658 if (blocked_by_policy) { |
| 684 blocked_local_shared_objects_.appcaches()->AddAppCache(manifest_url); | 659 blocked_local_shared_objects_.appcaches()->AddAppCache(manifest_url); |
| 685 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 660 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 686 } else { | 661 } else { |
| 687 allowed_local_shared_objects_.appcaches()->AddAppCache(manifest_url); | 662 allowed_local_shared_objects_.appcaches()->AddAppCache(manifest_url); |
| 688 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 663 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 689 } | 664 } |
| 690 } | 665 } |
| 691 | 666 |
| 692 void TabSpecificContentSettings::Observe( | 667 void TabSpecificContentSettings::Observe( |
| 693 int type, | 668 int type, |
| 694 const content::NotificationSource& source, | 669 const content::NotificationSource& source, |
| 695 const content::NotificationDetails& details) { | 670 const content::NotificationDetails& details) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 720 } | 695 } |
| 721 | 696 |
| 722 void TabSpecificContentSettings::RemoveSiteDataObserver( | 697 void TabSpecificContentSettings::RemoveSiteDataObserver( |
| 723 SiteDataObserver* observer) { | 698 SiteDataObserver* observer) { |
| 724 observer_list_.RemoveObserver(observer); | 699 observer_list_.RemoveObserver(observer); |
| 725 } | 700 } |
| 726 | 701 |
| 727 void TabSpecificContentSettings::NotifySiteDataObservers() { | 702 void TabSpecificContentSettings::NotifySiteDataObservers() { |
| 728 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 703 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
| 729 } | 704 } |
| OLD | NEW |