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