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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 21 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
24 #include "chrome/grit/theme_resources.h" | 24 #include "chrome/grit/theme_resources.h" |
25 #include "components/content_settings/core/browser/cookie_settings.h" | 25 #include "components/content_settings/core/browser/cookie_settings.h" |
26 #include "components/content_settings/core/common/pref_names.h" | 26 #include "components/content_settings/core/common/pref_names.h" |
27 #include "components/prefs/pref_service.h" | 27 #include "components/prefs/pref_service.h" |
28 #include "content/public/browser/notification_details.h" | 28 #include "content/public/browser/notification_details.h" |
29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
31 #include "third_party/apple_sample_code/ImageAndTextCell.h" | |
32 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 31 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
33 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 32 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
34 #include "ui/base/l10n/l10n_util_mac.h" | 33 #include "ui/base/l10n/l10n_util_mac.h" |
35 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
36 #include "ui/gfx/image/image.h" | 35 #include "ui/gfx/image/image.h" |
37 #include "ui/gfx/image/image_skia.h" | 36 #include "ui/gfx/image/image_skia.h" |
38 #include "ui/gfx/image/image_skia_util_mac.h" | 37 #include "ui/gfx/image/image_skia_util_mac.h" |
39 | 38 |
40 namespace { | 39 namespace { |
41 // Colors for the infobar. | 40 // Colors for the infobar. |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 276 } |
278 | 277 |
279 - (CocoaCookieTreeNode*)cocoaBlockedTreeModel { | 278 - (CocoaCookieTreeNode*)cocoaBlockedTreeModel { |
280 return blockedControllerBridge_->cocoa_model(); | 279 return blockedControllerBridge_->cocoa_model(); |
281 } | 280 } |
282 | 281 |
283 - (CookiesTreeModel*)blockedTreeModel { | 282 - (CookiesTreeModel*)blockedTreeModel { |
284 return blockedTreeModel_.get(); | 283 return blockedTreeModel_.get(); |
285 } | 284 } |
286 | 285 |
287 - (void)outlineView:(NSOutlineView*)outlineView | |
288 willDisplayCell:(id)cell | |
289 forTableColumn:(NSTableColumn*)tableColumn | |
290 item:(id)item { | |
291 CocoaCookieTreeNode* node = [item representedObject]; | |
292 int index; | |
293 if (outlineView == allowedOutlineView_) | |
294 index = allowedTreeModel_->GetIconIndex([node treeNode]); | |
295 else | |
296 index = blockedTreeModel_->GetIconIndex([node treeNode]); | |
297 NSImage* icon = nil; | |
298 if (index >= 0) | |
299 icon = [icons_ objectAtIndex:index]; | |
300 else | |
301 icon = [icons_ lastObject]; | |
302 DCHECK([cell isKindOfClass:[ImageAndTextCell class]]); | |
303 [static_cast<ImageAndTextCell*>(cell) setImage:icon]; | |
304 } | |
305 | |
306 - (void)outlineViewSelectionDidChange:(NSNotification*)notif { | 286 - (void)outlineViewSelectionDidChange:(NSNotification*)notif { |
307 BOOL isAllowedOutlineView; | 287 BOOL isAllowedOutlineView; |
308 if ([notif object] == allowedOutlineView_) { | 288 if ([notif object] == allowedOutlineView_) { |
309 isAllowedOutlineView = YES; | 289 isAllowedOutlineView = YES; |
310 } else if ([notif object] == blockedOutlineView_) { | 290 } else if ([notif object] == blockedOutlineView_) { |
311 isAllowedOutlineView = NO; | 291 isAllowedOutlineView = NO; |
312 } else { | 292 } else { |
313 NOTREACHED(); | 293 NOTREACHED(); |
314 return; | 294 return; |
315 } | 295 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 treeController = blockedTreeController_; | 490 treeController = blockedTreeController_; |
511 break; | 491 break; |
512 default: | 492 default: |
513 NOTREACHED(); | 493 NOTREACHED(); |
514 return; | 494 return; |
515 } | 495 } |
516 [detailsViewController_ configureBindingsForTreeController:treeController]; | 496 [detailsViewController_ configureBindingsForTreeController:treeController]; |
517 } | 497 } |
518 | 498 |
519 @end | 499 @end |
OLD | NEW |