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 [self setBlockedCookiesButtonsEnabled:NO]; | 377 [self setBlockedCookiesButtonsEnabled:NO]; |
378 } | 378 } |
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_data = |
388 content_settings->allowed_local_shared_objects(); | 388 content_settings->allowed_local_shared_objects(); |
389 { | 389 allowedTreeModel_ = allowed_data.CreateCookiesTreeModel(); |
390 ContainerMap apps_map; | |
391 apps_map[std::string()] = new LocalDataContainer( | |
392 std::string(), std::string(), | |
393 allowed_lsos.cookies()->Clone(), | |
394 allowed_lsos.databases()->Clone(), | |
395 allowed_lsos.local_storages()->Clone(), | |
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 | 390 |
403 allowedTreeModel_.reset(new CookiesTreeModel(apps_map, NULL, true)); | 391 const LocalSharedObjectsContainer& blocked_data = |
404 } | |
405 | |
406 const LocalSharedObjectsContainer& blocked_lsos = | |
407 content_settings->blocked_local_shared_objects(); | 392 content_settings->blocked_local_shared_objects(); |
408 { | 393 blockedTreeModel_ = blocked_data.CreateCookiesTreeModel(); |
409 ContainerMap apps_map; | |
410 apps_map[std::string()] = new LocalDataContainer( | |
411 std::string(), std::string(), | |
412 blocked_lsos.cookies()->Clone(), | |
413 blocked_lsos.databases()->Clone(), | |
414 blocked_lsos.local_storages()->Clone(), | |
415 blocked_lsos.session_storages()->Clone(), | |
416 blocked_lsos.appcaches()->Clone(), | |
417 blocked_lsos.indexed_dbs()->Clone(), | |
418 blocked_lsos.file_systems()->Clone(), | |
419 NULL, | |
420 blocked_lsos.server_bound_certs()->Clone()); | |
421 | |
422 blockedTreeModel_.reset(new CookiesTreeModel(apps_map, NULL, true)); | |
423 } | |
424 | 394 |
425 // Convert the model's icons from Skia to Cocoa. | 395 // Convert the model's icons from Skia to Cocoa. |
426 std::vector<gfx::ImageSkia> skiaIcons; | 396 std::vector<gfx::ImageSkia> skiaIcons; |
427 allowedTreeModel_->GetIcons(&skiaIcons); | 397 allowedTreeModel_->GetIcons(&skiaIcons); |
428 icons_.reset([[NSMutableArray alloc] init]); | 398 icons_.reset([[NSMutableArray alloc] init]); |
429 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); | 399 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); |
430 it != skiaIcons.end(); ++it) { | 400 it != skiaIcons.end(); ++it) { |
431 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; | 401 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; |
432 } | 402 } |
433 | 403 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 treeController = blockedTreeController_; | 539 treeController = blockedTreeController_; |
570 break; | 540 break; |
571 default: | 541 default: |
572 NOTREACHED(); | 542 NOTREACHED(); |
573 return; | 543 return; |
574 } | 544 } |
575 [detailsViewController_ configureBindingsForTreeController:treeController]; | 545 [detailsViewController_ configureBindingsForTreeController:treeController]; |
576 } | 546 } |
577 | 547 |
578 @end | 548 @end |
OLD | NEW |