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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 CollectedCookiesMac::CollectedCookiesMac(content::WebContents* web_contents) { | 75 CollectedCookiesMac::CollectedCookiesMac(content::WebContents* web_contents) { |
76 TabSpecificContentSettings* content_settings = | 76 TabSpecificContentSettings* content_settings = |
77 TabSpecificContentSettings::FromWebContents(web_contents); | 77 TabSpecificContentSettings::FromWebContents(web_contents); |
78 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, | 78 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, |
79 content::Source<TabSpecificContentSettings>(content_settings)); | 79 content::Source<TabSpecificContentSettings>(content_settings)); |
80 | 80 |
81 sheet_controller_.reset([[CollectedCookiesWindowController alloc] | 81 sheet_controller_.reset([[CollectedCookiesWindowController alloc] |
82 initWithWebContents:web_contents | 82 initWithWebContents:web_contents |
83 collectedCookiesMac:this]); | 83 collectedCookiesMac:this]); |
84 | 84 |
85 scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 85 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
86 [[CustomConstrainedWindowSheet alloc] | 86 [[CustomConstrainedWindowSheet alloc] |
87 initWithCustomWindow:[sheet_controller_ window]]); | 87 initWithCustomWindow:[sheet_controller_ window]]); |
88 window_.reset(new ConstrainedWindowMac( | 88 window_.reset(new ConstrainedWindowMac( |
89 this, web_contents, sheet)); | 89 this, web_contents, sheet)); |
90 } | 90 } |
91 | 91 |
92 CollectedCookiesMac::~CollectedCookiesMac() { | 92 CollectedCookiesMac::~CollectedCookiesMac() { |
93 } | 93 } |
94 | 94 |
95 void CollectedCookiesMac::Observe(int type, | 95 void CollectedCookiesMac::Observe(int type, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 NSColor* bannerStartingColor = | 163 NSColor* bannerStartingColor = |
164 [NSColor colorWithCalibratedRed:kBannerGradientColorTop[0] | 164 [NSColor colorWithCalibratedRed:kBannerGradientColorTop[0] |
165 green:kBannerGradientColorTop[1] | 165 green:kBannerGradientColorTop[1] |
166 blue:kBannerGradientColorTop[2] | 166 blue:kBannerGradientColorTop[2] |
167 alpha:1.0]; | 167 alpha:1.0]; |
168 NSColor* bannerEndingColor = | 168 NSColor* bannerEndingColor = |
169 [NSColor colorWithCalibratedRed:kBannerGradientColorBottom[0] | 169 [NSColor colorWithCalibratedRed:kBannerGradientColorBottom[0] |
170 green:kBannerGradientColorBottom[1] | 170 green:kBannerGradientColorBottom[1] |
171 blue:kBannerGradientColorBottom[2] | 171 blue:kBannerGradientColorBottom[2] |
172 alpha:1.0]; | 172 alpha:1.0]; |
173 scoped_nsobject<NSGradient> bannerGradient( | 173 base::scoped_nsobject<NSGradient> bannerGradient( |
174 [[NSGradient alloc] initWithStartingColor:bannerStartingColor | 174 [[NSGradient alloc] initWithStartingColor:bannerStartingColor |
175 endingColor:bannerEndingColor]); | 175 endingColor:bannerEndingColor]); |
176 [infoBar_ setGradient:bannerGradient]; | 176 [infoBar_ setGradient:bannerGradient]; |
177 | 177 |
178 NSColor* bannerStrokeColor = | 178 NSColor* bannerStrokeColor = |
179 [NSColor colorWithCalibratedWhite:kBannerStrokeColor | 179 [NSColor colorWithCalibratedWhite:kBannerStrokeColor |
180 alpha:1.0]; | 180 alpha:1.0]; |
181 [infoBar_ setStrokeColor:bannerStrokeColor]; | 181 [infoBar_ setStrokeColor:bannerStrokeColor]; |
182 | 182 |
183 // Change the label of the blocked cookies part if necessary. | 183 // Change the label of the blocked cookies part if necessary. |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 // Default icon will be the last item in the array. | 376 // Default icon will be the last item in the array. |
377 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 377 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
378 // TODO(rsesek): Rename this resource now that it's in multiple places. | 378 // TODO(rsesek): Rename this resource now that it's in multiple places. |
379 [icons_ addObject: | 379 [icons_ addObject: |
380 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).ToNSImage()]; | 380 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_FOLDER).ToNSImage()]; |
381 | 381 |
382 // Create the Cocoa model. | 382 // Create the Cocoa model. |
383 CookieTreeNode* root = | 383 CookieTreeNode* root = |
384 static_cast<CookieTreeNode*>(allowedTreeModel_->GetRoot()); | 384 static_cast<CookieTreeNode*>(allowedTreeModel_->GetRoot()); |
385 scoped_nsobject<CocoaCookieTreeNode> model( | 385 base::scoped_nsobject<CocoaCookieTreeNode> model( |
386 [[CocoaCookieTreeNode alloc] initWithNode:root]); | 386 [[CocoaCookieTreeNode alloc] initWithNode:root]); |
387 [self setCocoaAllowedTreeModel:model.get()]; // Takes ownership. | 387 [self setCocoaAllowedTreeModel:model.get()]; // Takes ownership. |
388 root = static_cast<CookieTreeNode*>(blockedTreeModel_->GetRoot()); | 388 root = static_cast<CookieTreeNode*>(blockedTreeModel_->GetRoot()); |
389 model.reset( | 389 model.reset( |
390 [[CocoaCookieTreeNode alloc] initWithNode:root]); | 390 [[CocoaCookieTreeNode alloc] initWithNode:root]); |
391 [self setCocoaBlockedTreeModel:model.get()]; // Takes ownership. | 391 [self setCocoaBlockedTreeModel:model.get()]; // Takes ownership. |
392 } | 392 } |
393 | 393 |
394 -(void)showInfoBarForMultipleDomainsAndSetting:(ContentSetting)setting { | 394 -(void)showInfoBarForMultipleDomainsAndSetting:(ContentSetting)setting { |
395 NSString* label; | 395 NSString* label; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 treeController = blockedTreeController_; | 512 treeController = blockedTreeController_; |
513 break; | 513 break; |
514 default: | 514 default: |
515 NOTREACHED(); | 515 NOTREACHED(); |
516 return; | 516 return; |
517 } | 517 } |
518 [detailsViewController_ configureBindingsForTreeController:treeController]; | 518 [detailsViewController_ configureBindingsForTreeController:treeController]; |
519 } | 519 } |
520 | 520 |
521 @end | 521 @end |
OLD | NEW |