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