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 { |
388 allowed_lsos.databases()->Clone(), | 388 ContainerMap apps_map; |
389 allowed_lsos.local_storages()->Clone(), | 389 // TODO(nasko): once the app node of the tree is no longer visible, the |
390 allowed_lsos.session_storages()->Clone(), | 390 // name won't matter and should be changed to empty string. |
391 allowed_lsos.appcaches()->Clone(), | 391 apps_map[std::string()] = new LocalDataContainer( |
392 allowed_lsos.indexed_dbs()->Clone(), | 392 "Site Data", std::string(), |
393 allowed_lsos.file_systems()->Clone(), | 393 allowed_lsos.cookies()->Clone(), |
394 NULL, | 394 allowed_lsos.databases()->Clone(), |
395 allowed_lsos.server_bound_certs()->Clone(), | 395 allowed_lsos.local_storages()->Clone(), |
396 true)); | 396 allowed_lsos.session_storages()->Clone(), |
| 397 allowed_lsos.appcaches()->Clone(), |
| 398 allowed_lsos.indexed_dbs()->Clone(), |
| 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 |
397 const LocalSharedObjectsContainer& blocked_lsos = | 406 const LocalSharedObjectsContainer& blocked_lsos = |
398 content_settings->blocked_local_shared_objects(); | 407 content_settings->blocked_local_shared_objects(); |
399 blockedTreeModel_.reset( | 408 |
400 new CookiesTreeModel(blocked_lsos.cookies()->Clone(), | 409 { |
401 blocked_lsos.databases()->Clone(), | 410 ContainerMap apps_map; |
402 blocked_lsos.local_storages()->Clone(), | 411 // TODO(nasko): once the app node of the tree is no longer visible, the |
403 blocked_lsos.session_storages()->Clone(), | 412 // name won't matter and should be changed to empty string. |
404 blocked_lsos.appcaches()->Clone(), | 413 apps_map[std::string()] = new LocalDataContainer( |
405 blocked_lsos.indexed_dbs()->Clone(), | 414 "Site Data", std::string(), |
406 blocked_lsos.file_systems()->Clone(), | 415 blocked_lsos.cookies()->Clone(), |
407 NULL, | 416 blocked_lsos.databases()->Clone(), |
408 blocked_lsos.server_bound_certs()->Clone(), | 417 blocked_lsos.local_storages()->Clone(), |
409 true)); | 418 blocked_lsos.session_storages()->Clone(), |
| 419 blocked_lsos.appcaches()->Clone(), |
| 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 } |
410 | 427 |
411 // Convert the model's icons from Skia to Cocoa. | 428 // Convert the model's icons from Skia to Cocoa. |
412 std::vector<gfx::ImageSkia> skiaIcons; | 429 std::vector<gfx::ImageSkia> skiaIcons; |
413 allowedTreeModel_->GetIcons(&skiaIcons); | 430 allowedTreeModel_->GetIcons(&skiaIcons); |
414 icons_.reset([[NSMutableArray alloc] init]); | 431 icons_.reset([[NSMutableArray alloc] init]); |
415 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); | 432 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); |
416 it != skiaIcons.end(); ++it) { | 433 it != skiaIcons.end(); ++it) { |
417 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; | 434 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; |
418 } | 435 } |
419 | 436 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 treeController = blockedTreeController_; | 572 treeController = blockedTreeController_; |
556 break; | 573 break; |
557 default: | 574 default: |
558 NOTREACHED(); | 575 NOTREACHED(); |
559 return; | 576 return; |
560 } | 577 } |
561 [detailsViewController_ configureBindingsForTreeController:treeController]; | 578 [detailsViewController_ configureBindingsForTreeController:treeController]; |
562 } | 579 } |
563 | 580 |
564 @end | 581 @end |
OLD | NEW |