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