Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Tiny fixes (unnecessary #includes, win + mac fixes). Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "base/mac/mac_util.h" 9 #import "base/mac/mac_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/browser/content_settings/host_content_settings_map.h" 11 #include "chrome/browser/content_settings/cookie_settings.h"
12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" 14 #include "chrome/browser/ui/cocoa/constrained_window_mac.h"
15 #import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller .h" 15 #import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller .h"
16 #import "chrome/browser/ui/cocoa/vertical_gradient_view.h" 16 #import "chrome/browser/ui/cocoa/vertical_gradient_view.h"
17 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" 17 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
19 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
20 #include "content/browser/tab_contents/tab_contents.h" 20 #include "content/browser/tab_contents/tab_contents.h"
21 #include "content/common/notification_details.h" 21 #include "content/common/notification_details.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 [infoBar_ setGradient:bannerGradient]; 180 [infoBar_ setGradient:bannerGradient];
181 181
182 NSColor* bannerStrokeColor = 182 NSColor* bannerStrokeColor =
183 [NSColor colorWithCalibratedWhite:kBannerStrokeColor 183 [NSColor colorWithCalibratedWhite:kBannerStrokeColor
184 alpha:1.0]; 184 alpha:1.0];
185 [infoBar_ setStrokeColor:bannerStrokeColor]; 185 [infoBar_ setStrokeColor:bannerStrokeColor];
186 186
187 // Change the label of the blocked cookies part if necessary. 187 // Change the label of the blocked cookies part if necessary.
188 Profile* profile = 188 Profile* profile =
189 Profile::FromBrowserContext(tabContents_->browser_context()); 189 Profile::FromBrowserContext(tabContents_->browser_context());
190 if (profile->GetHostContentSettingsMap()->BlockThirdPartyCookies()) { 190 CookieSettings* cookie_settings =
191 CookieSettings::GetForProfile(profile);
192 if (cookie_settings->ShouldBlockThirdPartyCookies()) {
191 [blockedCookiesText_ setStringValue:l10n_util::GetNSString( 193 [blockedCookiesText_ setStringValue:l10n_util::GetNSString(
192 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED)]; 194 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED)];
193 CGFloat textDeltaY = [GTMUILocalizerAndLayoutTweaker 195 CGFloat textDeltaY = [GTMUILocalizerAndLayoutTweaker
194 sizeToFitFixedWidthTextField:blockedCookiesText_]; 196 sizeToFitFixedWidthTextField:blockedCookiesText_];
195 197
196 // Shrink the blocked cookies outline view. 198 // Shrink the blocked cookies outline view.
197 NSRect frame = [blockedScrollView_ frame]; 199 NSRect frame = [blockedScrollView_ frame];
198 frame.size.height -= textDeltaY; 200 frame.size.height -= textDeltaY;
199 [blockedScrollView_ setFrame:frame]; 201 [blockedScrollView_ setFrame:frame];
200 202
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 CocoaCookieTreeNode* node = [treeNode representedObject]; 242 CocoaCookieTreeNode* node = [treeNode representedObject];
241 CookieTreeNode* cookie = static_cast<CookieTreeNode*>([node treeNode]); 243 CookieTreeNode* cookie = static_cast<CookieTreeNode*>([node treeNode]);
242 if (cookie->GetDetailedInfo().node_type != 244 if (cookie->GetDetailedInfo().node_type !=
243 CookieTreeNode::DetailedInfo::TYPE_ORIGIN) { 245 CookieTreeNode::DetailedInfo::TYPE_ORIGIN) {
244 continue; 246 continue;
245 } 247 }
246 Profile* profile = 248 Profile* profile =
247 Profile::FromBrowserContext(tabContents_->browser_context()); 249 Profile::FromBrowserContext(tabContents_->browser_context());
248 CookieTreeOriginNode* origin_node = 250 CookieTreeOriginNode* origin_node =
249 static_cast<CookieTreeOriginNode*>(cookie); 251 static_cast<CookieTreeOriginNode*>(cookie);
250 origin_node->CreateContentException(profile->GetHostContentSettingsMap(), 252 origin_node->CreateContentException(CookieSettings::GetForProfile(profile),
251 setting); 253 setting);
252 if (!lastDomain.empty()) 254 if (!lastDomain.empty())
253 multipleDomainsChanged = YES; 255 multipleDomainsChanged = YES;
254 lastDomain = origin_node->GetTitle(); 256 lastDomain = origin_node->GetTitle();
255 } 257 }
256 if (multipleDomainsChanged) 258 if (multipleDomainsChanged)
257 [self showInfoBarForMultipleDomainsAndSetting:setting]; 259 [self showInfoBarForMultipleDomainsAndSetting:setting];
258 else 260 else
259 [self showInfoBarForDomain:lastDomain setting:setting]; 261 [self showInfoBarForDomain:lastDomain setting:setting];
260 contentSettingsChanged_ = YES; 262 contentSettingsChanged_ = YES;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 treeController = blockedTreeController_; 513 treeController = blockedTreeController_;
512 break; 514 break;
513 default: 515 default:
514 NOTREACHED(); 516 NOTREACHED();
515 return; 517 return;
516 } 518 }
517 [detailsViewController_ configureBindingsForTreeController:treeController]; 519 [detailsViewController_ configureBindingsForTreeController:treeController];
518 } 520 }
519 521
520 @end 522 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698