OLD | NEW |
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 #include "chrome/browser/ui/views/collected_cookies_win.h" | 5 #include "chrome/browser/ui/views/collected_cookies_win.h" |
6 | 6 |
| 7 #include "chrome/browser/content_settings/cookie_settings.h" |
7 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/cookies_tree_model.h" | 10 #include "chrome/browser/cookies_tree_model.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 12 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/browser/ui/views/constrained_window_views.h" | 14 #include "chrome/browser/ui/views/constrained_window_views.h" |
14 #include "chrome/browser/ui/views/cookie_info_view.h" | 15 #include "chrome/browser/ui/views/cookie_info_view.h" |
15 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
16 #include "content/common/notification_details.h" | 17 #include "content/common/notification_details.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 GridLayout::CENTER); | 285 GridLayout::CENTER); |
285 | 286 |
286 return pane; | 287 return pane; |
287 } | 288 } |
288 | 289 |
289 views::View* CollectedCookiesWin::CreateBlockedPane() { | 290 views::View* CollectedCookiesWin::CreateBlockedPane() { |
290 TabContentsWrapper* wrapper = | 291 TabContentsWrapper* wrapper = |
291 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); | 292 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); |
292 TabSpecificContentSettings* content_settings = wrapper->content_settings(); | 293 TabSpecificContentSettings* content_settings = wrapper->content_settings(); |
293 | 294 |
294 HostContentSettingsMap* host_content_settings_map = | 295 CookieSettings* cookie_settings = |
295 wrapper->profile()->GetHostContentSettingsMap(); | 296 CookieSettings::GetForProfile(wrapper->profile()); |
296 | 297 |
297 // Create the controls that go into the pane. | 298 // Create the controls that go into the pane. |
298 blocked_label_ = new views::Label( | 299 blocked_label_ = new views::Label( |
299 UTF16ToWide(l10n_util::GetStringUTF16( | 300 UTF16ToWide(l10n_util::GetStringUTF16( |
300 host_content_settings_map->BlockThirdPartyCookies() ? | 301 cookie_settings->ShouldBlockThirdPartyCookies() ? |
301 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : | 302 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : |
302 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL))); | 303 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL))); |
303 blocked_label_->SetMultiLine(true); | 304 blocked_label_->SetMultiLine(true); |
304 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 305 blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
305 blocked_cookies_tree_model_.reset( | 306 blocked_cookies_tree_model_.reset( |
306 content_settings->GetBlockedCookiesTreeModel()); | 307 content_settings->GetBlockedCookiesTreeModel()); |
307 blocked_cookies_tree_ = new views::TreeView(); | 308 blocked_cookies_tree_ = new views::TreeView(); |
308 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); | 309 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get()); |
309 blocked_cookies_tree_->SetController(this); | 310 blocked_cookies_tree_->SetController(this); |
310 blocked_cookies_tree_->SetRootShown(false); | 311 blocked_cookies_tree_->SetRootShown(false); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 504 |
504 /////////////////////////////////////////////////////////////////////////////// | 505 /////////////////////////////////////////////////////////////////////////////// |
505 // NotificationObserver implementation. | 506 // NotificationObserver implementation. |
506 | 507 |
507 void CollectedCookiesWin::Observe(int type, | 508 void CollectedCookiesWin::Observe(int type, |
508 const NotificationSource& source, | 509 const NotificationSource& source, |
509 const NotificationDetails& details) { | 510 const NotificationDetails& details) { |
510 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); | 511 DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); |
511 window_->CloseConstrainedWindow(); | 512 window_->CloseConstrainedWindow(); |
512 } | 513 } |
OLD | NEW |