Chromium Code Reviews| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 [self loadTreeModelFromTabContents]; | 176 [self loadTreeModelFromTabContents]; |
| 177 | 177 |
| 178 animation_.reset([[NSViewAnimation alloc] init]); | 178 animation_.reset([[NSViewAnimation alloc] init]); |
| 179 [animation_ setAnimationBlockingMode:NSAnimationNonblocking]; | 179 [animation_ setAnimationBlockingMode:NSAnimationNonblocking]; |
| 180 } | 180 } |
| 181 return self; | 181 return self; |
| 182 } | 182 } |
| 183 | 183 |
| 184 - (void)awakeFromNib { | 184 - (void)awakeFromNib { |
| 185 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 185 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 186 NSImage* infoIcon = rb.GetNativeImageNamed(IDR_INFO); | 186 NSImage* infoIcon = rb.GetNativeImageNamed(IDR_INFO).ToNSImage(); |
| 187 DCHECK(infoIcon); | |
|
rohitrao (ping after 24h)
2012/09/14 00:11:21
Why no DCHECK anymore?
Robert Sesek
2012/09/14 14:37:15
ToNSImage() CHECKs.
| |
| 188 [infoBarIcon_ setImage:infoIcon]; | 187 [infoBarIcon_ setImage:infoIcon]; |
| 189 | 188 |
| 190 // Initialize the banner gradient and stroke color. | 189 // Initialize the banner gradient and stroke color. |
| 191 NSColor* bannerStartingColor = | 190 NSColor* bannerStartingColor = |
| 192 [NSColor colorWithCalibratedRed:kBannerGradientColorTop[0] | 191 [NSColor colorWithCalibratedRed:kBannerGradientColorTop[0] |
| 193 green:kBannerGradientColorTop[1] | 192 green:kBannerGradientColorTop[1] |
| 194 blue:kBannerGradientColorTop[2] | 193 blue:kBannerGradientColorTop[2] |
| 195 alpha:1.0]; | 194 alpha:1.0]; |
| 196 NSColor* bannerEndingColor = | 195 NSColor* bannerEndingColor = |
| 197 [NSColor colorWithCalibratedRed:kBannerGradientColorBottom[0] | 196 [NSColor colorWithCalibratedRed:kBannerGradientColorBottom[0] |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 allowedTreeModel_->GetIcons(&skiaIcons); | 396 allowedTreeModel_->GetIcons(&skiaIcons); |
| 398 icons_.reset([[NSMutableArray alloc] init]); | 397 icons_.reset([[NSMutableArray alloc] init]); |
| 399 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); | 398 for (std::vector<gfx::ImageSkia>::iterator it = skiaIcons.begin(); |
| 400 it != skiaIcons.end(); ++it) { | 399 it != skiaIcons.end(); ++it) { |
| 401 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; | 400 [icons_ addObject:gfx::NSImageFromImageSkia(*it)]; |
| 402 } | 401 } |
| 403 | 402 |
| 404 // Default icon will be the last item in the array. | 403 // Default icon will be the last item in the array. |
| 405 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 404 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 406 // TODO(rsesek): Rename this resource now that it's in multiple places. | 405 // TODO(rsesek): Rename this resource now that it's in multiple places. |
| 407 [icons_ addObject:rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER)]; | 406 [icons_ addObject: |
| 407 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).ToNSImage()]; | |
| 408 | 408 |
| 409 // Create the Cocoa model. | 409 // Create the Cocoa model. |
| 410 CookieTreeNode* root = | 410 CookieTreeNode* root = |
| 411 static_cast<CookieTreeNode*>(allowedTreeModel_->GetRoot()); | 411 static_cast<CookieTreeNode*>(allowedTreeModel_->GetRoot()); |
| 412 scoped_nsobject<CocoaCookieTreeNode> model( | 412 scoped_nsobject<CocoaCookieTreeNode> model( |
| 413 [[CocoaCookieTreeNode alloc] initWithNode:root]); | 413 [[CocoaCookieTreeNode alloc] initWithNode:root]); |
| 414 [self setCocoaAllowedTreeModel:model.get()]; // Takes ownership. | 414 [self setCocoaAllowedTreeModel:model.get()]; // Takes ownership. |
| 415 root = static_cast<CookieTreeNode*>(blockedTreeModel_->GetRoot()); | 415 root = static_cast<CookieTreeNode*>(blockedTreeModel_->GetRoot()); |
| 416 model.reset( | 416 model.reset( |
| 417 [[CocoaCookieTreeNode alloc] initWithNode:root]); | 417 [[CocoaCookieTreeNode alloc] initWithNode:root]); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 treeController = blockedTreeController_; | 539 treeController = blockedTreeController_; |
| 540 break; | 540 break; |
| 541 default: | 541 default: |
| 542 NOTREACHED(); | 542 NOTREACHED(); |
| 543 return; | 543 return; |
| 544 } | 544 } |
| 545 [detailsViewController_ configureBindingsForTreeController:treeController]; | 545 [detailsViewController_ configureBindingsForTreeController:treeController]; |
| 546 } | 546 } |
| 547 | 547 |
| 548 @end | 548 @end |
| OLD | NEW |