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