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