| 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 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 13 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 14 #include "chrome/browser/content_settings/local_shared_objects_container.h" |
| 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 15 #include "chrome/browser/infobars/infobar_service.h" | 16 #include "chrome/browser/infobars/infobar_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 18 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
| 18 #import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller
.h" | 19 #import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller
.h" |
| 19 #import "chrome/browser/ui/cocoa/vertical_gradient_view.h" | 20 #import "chrome/browser/ui/cocoa/vertical_gradient_view.h" |
| 20 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 21 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
| 23 #include "chrome/grit/theme_resources.h" | 24 #include "chrome/grit/theme_resources.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 [self setBlockedCookiesButtonsEnabled:NO]; | 347 [self setBlockedCookiesButtonsEnabled:NO]; |
| 347 } | 348 } |
| 348 } | 349 } |
| 349 | 350 |
| 350 // Initializes the |allowedTreeModel_| and |blockedTreeModel_|, and builds | 351 // Initializes the |allowedTreeModel_| and |blockedTreeModel_|, and builds |
| 351 // the |cocoaAllowedTreeModel_| and |cocoaBlockedTreeModel_|. | 352 // the |cocoaAllowedTreeModel_| and |cocoaBlockedTreeModel_|. |
| 352 - (void)loadTreeModelFromWebContents { | 353 - (void)loadTreeModelFromWebContents { |
| 353 TabSpecificContentSettings* content_settings = | 354 TabSpecificContentSettings* content_settings = |
| 354 TabSpecificContentSettings::FromWebContents(webContents_); | 355 TabSpecificContentSettings::FromWebContents(webContents_); |
| 355 | 356 |
| 356 allowedTreeModel_ = content_settings->CreateAllowedCookiesTreeModel(); | 357 allowedTreeModel_ = |
| 357 blockedTreeModel_ = content_settings->CreateBlockedCookiesTreeModel(); | 358 content_settings->allowed_local_shared_objects().CreateCookiesTreeModel(); |
| 359 |
| 360 blockedTreeModel_ = |
| 361 content_settings->blocked_local_shared_objects().CreateCookiesTreeModel(); |
| 358 | 362 |
| 359 // Convert the model's icons from Skia to Cocoa. | 363 // Convert the model's icons from Skia to Cocoa. |
| 360 std::vector<gfx::ImageSkia> skiaIcons; | 364 std::vector<gfx::ImageSkia> skiaIcons; |
| 361 allowedTreeModel_->GetIcons(&skiaIcons); | 365 allowedTreeModel_->GetIcons(&skiaIcons); |
| 362 icons_.reset([[NSMutableArray alloc] init]); | 366 icons_.reset([[NSMutableArray alloc] init]); |
| 363 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); | 367 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); |
| 364 it != skiaIcons.end(); ++it) { | 368 it != skiaIcons.end(); ++it) { |
| 365 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; | 369 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; |
| 366 } | 370 } |
| 367 | 371 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 treeController = blockedTreeController_; | 510 treeController = blockedTreeController_; |
| 507 break; | 511 break; |
| 508 default: | 512 default: |
| 509 NOTREACHED(); | 513 NOTREACHED(); |
| 510 return; | 514 return; |
| 511 } | 515 } |
| 512 [detailsViewController_ configureBindingsForTreeController:treeController]; | 516 [detailsViewController_ configureBindingsForTreeController:treeController]; |
| 513 } | 517 } |
| 514 | 518 |
| 515 @end | 519 @end |
| OLD | NEW |