| 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 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" | 5 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #import "base/mac/mac_util.h" | 10 #import "base/mac/mac_util.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 377 } |
| 378 | 378 |
| 379 // Initializes the |allowedTreeModel_| and |blockedTreeModel_|, and builds | 379 // Initializes the |allowedTreeModel_| and |blockedTreeModel_|, and builds |
| 380 // the |cocoaAllowedTreeModel_| and |cocoaBlockedTreeModel_|. | 380 // the |cocoaAllowedTreeModel_| and |cocoaBlockedTreeModel_|. |
| 381 - (void)loadTreeModelFromTabContents { | 381 - (void)loadTreeModelFromTabContents { |
| 382 TabSpecificContentSettings* content_settings = | 382 TabSpecificContentSettings* content_settings = |
| 383 tab_contents_->content_settings(); | 383 tab_contents_->content_settings(); |
| 384 | 384 |
| 385 const LocalSharedObjectsContainer& allowed_lsos = | 385 const LocalSharedObjectsContainer& allowed_lsos = |
| 386 content_settings->allowed_local_shared_objects(); | 386 content_settings->allowed_local_shared_objects(); |
| 387 allowedTreeModel_.reset( | 387 |
| 388 new CookiesTreeModel(allowed_lsos.cookies()->Clone(), | 388 string16 name = ASCIIToUTF16("Site Data"); |
| 389 allowed_lsos.databases()->Clone(), | 389 string16 browser_id; |
| 390 allowed_lsos.local_storages()->Clone(), | 390 |
| 391 allowed_lsos.session_storages()->Clone(), | 391 { |
| 392 allowed_lsos.appcaches()->Clone(), | 392 ContainerMap apps_map; |
| 393 allowed_lsos.indexed_dbs()->Clone(), | 393 apps_map[name] = new LocalDataContainer( |
| 394 allowed_lsos.file_systems()->Clone(), | 394 name, browser_id, |
| 395 NULL, | 395 allowed_lsos.cookies()->Clone(), |
| 396 allowed_lsos.server_bound_certs()->Clone(), | 396 allowed_lsos.databases()->Clone(), |
| 397 true)); | 397 allowed_lsos.local_storages()->Clone(), |
| 398 allowed_lsos.session_storages()->Clone(), |
| 399 allowed_lsos.appcaches()->Clone(), |
| 400 allowed_lsos.indexed_dbs()->Clone(), |
| 401 allowed_lsos.file_systems()->Clone(), |
| 402 NULL, |
| 403 allowed_lsos.server_bound_certs()->Clone()); |
| 404 |
| 405 allowedTreeModel_.reset(new CookiesTreeModel(apps_map, true)); |
| 406 } |
| 407 |
| 398 const LocalSharedObjectsContainer& blocked_lsos = | 408 const LocalSharedObjectsContainer& blocked_lsos = |
| 399 content_settings->blocked_local_shared_objects(); | 409 content_settings->blocked_local_shared_objects(); |
| 400 blockedTreeModel_.reset( | 410 |
| 401 new CookiesTreeModel(blocked_lsos.cookies()->Clone(), | 411 { |
| 402 blocked_lsos.databases()->Clone(), | 412 ContainerMap apps_map; |
| 403 blocked_lsos.local_storages()->Clone(), | 413 apps_map[name] = new LocalDataContainer( |
| 404 blocked_lsos.session_storages()->Clone(), | 414 name, browser_id, |
| 405 blocked_lsos.appcaches()->Clone(), | 415 blocked_lsos.cookies()->Clone(), |
| 406 blocked_lsos.indexed_dbs()->Clone(), | 416 blocked_lsos.databases()->Clone(), |
| 407 blocked_lsos.file_systems()->Clone(), | 417 blocked_lsos.local_storages()->Clone(), |
| 408 NULL, | 418 blocked_lsos.session_storages()->Clone(), |
| 409 blocked_lsos.server_bound_certs()->Clone(), | 419 blocked_lsos.appcaches()->Clone(), |
| 410 true)); | 420 blocked_lsos.indexed_dbs()->Clone(), |
| 421 blocked_lsos.file_systems()->Clone(), |
| 422 NULL, |
| 423 blocked_lsos.server_bound_certs()->Clone()); |
| 424 |
| 425 blockedTreeModel_.reset(new CookiesTreeModel(apps_map, true)); |
| 426 } |
| 411 | 427 |
| 412 // Convert the model's icons from Skia to Cocoa. | 428 // Convert the model's icons from Skia to Cocoa. |
| 413 std::vector<gfx::ImageSkia> skiaIcons; | 429 std::vector<gfx::ImageSkia> skiaIcons; |
| 414 allowedTreeModel_->GetIcons(&skiaIcons); | 430 allowedTreeModel_->GetIcons(&skiaIcons); |
| 415 icons_.reset([[NSMutableArray alloc] init]); | 431 icons_.reset([[NSMutableArray alloc] init]); |
| 416 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); | 432 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); |
| 417 it != skiaIcons.end(); ++it) { | 433 it != skiaIcons.end(); ++it) { |
| 418 [icons_ addObject:gfx::SkBitmapToNSImage(*it->bitmap())]; | 434 [icons_ addObject:gfx::SkBitmapToNSImage(*it->bitmap())]; |
| 419 } | 435 } |
| 420 | 436 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 treeController = blockedTreeController_; | 572 treeController = blockedTreeController_; |
| 557 break; | 573 break; |
| 558 default: | 574 default: |
| 559 NOTREACHED(); | 575 NOTREACHED(); |
| 560 return; | 576 return; |
| 561 } | 577 } |
| 562 [detailsViewController_ configureBindingsForTreeController:treeController]; | 578 [detailsViewController_ configureBindingsForTreeController:treeController]; |
| 563 } | 579 } |
| 564 | 580 |
| 565 @end | 581 @end |
| OLD | NEW |