Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / collected_cookies_views.cc
blobaba1c026495dcd7af6778302e467b5e0d7fe4f92
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/collected_cookies_views.h"
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
11 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
12 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
13 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
14 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h"
15 #include "chrome/browser/browsing_data/cookies_tree_model.h"
16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/content_settings/cookie_settings.h"
18 #include "chrome/browser/content_settings/local_shared_objects_container.h"
19 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
20 #include "chrome/browser/infobars/infobar_service.h"
21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
23 #include "chrome/browser/ui/views/constrained_window_views.h"
24 #include "chrome/browser/ui/views/cookie_info_view.h"
25 #include "chrome/common/pref_names.h"
26 #include "components/web_modal/web_contents_modal_dialog_host.h"
27 #include "components/web_modal/web_contents_modal_dialog_manager.h"
28 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
29 #include "content/public/browser/notification_details.h"
30 #include "content/public/browser/notification_source.h"
31 #include "content/public/browser/web_contents.h"
32 #include "grit/generated_resources.h"
33 #include "grit/locale_settings.h"
34 #include "grit/theme_resources.h"
35 #include "net/cookies/canonical_cookie.h"
36 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/resource/resource_bundle.h"
38 #include "ui/gfx/color_utils.h"
39 #include "ui/views/border.h"
40 #include "ui/views/controls/button/label_button.h"
41 #include "ui/views/controls/image_view.h"
42 #include "ui/views/controls/label.h"
43 #include "ui/views/controls/scroll_view.h"
44 #include "ui/views/controls/tabbed_pane/tabbed_pane.h"
45 #include "ui/views/controls/tree/tree_view.h"
46 #include "ui/views/layout/box_layout.h"
47 #include "ui/views/layout/grid_layout.h"
48 #include "ui/views/layout/layout_constants.h"
49 #include "ui/views/widget/widget.h"
50 #include "ui/views/window/dialog_delegate.h"
52 using web_modal::WebContentsModalDialogManager;
53 using web_modal::WebContentsModalDialogManagerDelegate;
55 namespace chrome {
57 // Declared in browser_dialogs.h so others don't have to depend on our header.
58 void ShowCollectedCookiesDialog(content::WebContents* web_contents) {
59 // Deletes itself on close.
60 new CollectedCookiesViews(web_contents);
63 } // namespace chrome
65 namespace {
67 // Spacing between the infobar frame and its contents.
68 const int kInfobarVerticalPadding = 3;
69 const int kInfobarHorizontalPadding = 8;
71 // Width of the infobar frame.
72 const int kInfobarBorderSize = 1;
74 // Dimensions of the tree views.
75 const int kTreeViewWidth = 400;
76 const int kTreeViewHeight = 125;
78 // The color of the border around the cookies tree view.
79 const SkColor kCookiesBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8);
81 // Spacing constants used with the new dialog style.
82 const int kTabbedPaneTopPadding = 14;
83 const int kLabelBottomPadding = 17;
84 const int kCookieInfoBottomPadding = 4;
85 const int kVPanelPadding = 15;
87 } // namespace
89 // A custom view that conditionally displays an infobar.
90 class InfobarView : public views::View {
91 public:
92 InfobarView() {
93 content_ = new views::View;
94 #if defined(USE_AURA) || !defined(OS_WIN)
95 SkColor border_color = SK_ColorGRAY;
96 #else
97 SkColor border_color = color_utils::GetSysSkColor(COLOR_3DSHADOW);
98 #endif
99 views::Border* border = views::Border::CreateSolidBorder(
100 kInfobarBorderSize, border_color);
101 content_->set_border(border);
103 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
104 info_image_ = new views::ImageView();
105 info_image_->SetImage(rb.GetImageSkiaNamed(IDR_INFO));
106 label_ = new views::Label();
108 virtual ~InfobarView() {}
110 // Update the visibility of the infobar. If |is_visible| is true, a rule for
111 // |setting| on |domain_name| was created.
112 void UpdateVisibility(bool is_visible,
113 ContentSetting setting,
114 const base::string16& domain_name) {
115 if (!is_visible) {
116 SetVisible(false);
117 return;
120 base::string16 label;
121 switch (setting) {
122 case CONTENT_SETTING_BLOCK:
123 label = l10n_util::GetStringFUTF16(
124 IDS_COLLECTED_COOKIES_BLOCK_RULE_CREATED, domain_name);
125 break;
127 case CONTENT_SETTING_ALLOW:
128 label = l10n_util::GetStringFUTF16(
129 IDS_COLLECTED_COOKIES_ALLOW_RULE_CREATED, domain_name);
130 break;
132 case CONTENT_SETTING_SESSION_ONLY:
133 label = l10n_util::GetStringFUTF16(
134 IDS_COLLECTED_COOKIES_SESSION_RULE_CREATED, domain_name);
135 break;
137 default:
138 NOTREACHED();
140 label_->SetText(label);
141 content_->Layout();
142 SetVisible(true);
145 private:
146 // Initialize contents and layout.
147 void Init() {
148 AddChildView(content_);
149 content_->SetLayoutManager(
150 new views::BoxLayout(views::BoxLayout::kHorizontal,
151 kInfobarHorizontalPadding,
152 kInfobarVerticalPadding,
153 views::kRelatedControlSmallHorizontalSpacing));
154 content_->AddChildView(info_image_);
155 content_->AddChildView(label_);
156 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16());
159 // views::View overrides.
160 virtual gfx::Size GetPreferredSize() OVERRIDE {
161 if (!visible())
162 return gfx::Size();
164 // Add space around the banner.
165 gfx::Size size(content_->GetPreferredSize());
166 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing);
167 return size;
170 virtual void Layout() OVERRIDE {
171 content_->SetBounds(
172 0, views::kRelatedControlVerticalSpacing,
173 width(), height() - views::kRelatedControlVerticalSpacing);
176 virtual void ViewHierarchyChanged(
177 const ViewHierarchyChangedDetails& details) OVERRIDE {
178 if (details.is_add && details.child == this)
179 Init();
182 // Holds the info icon image and text label and renders the border.
183 views::View* content_;
184 // Info icon image.
185 views::ImageView* info_image_;
186 // The label responsible for rendering the text.
187 views::Label* label_;
189 DISALLOW_COPY_AND_ASSIGN(InfobarView);
192 ///////////////////////////////////////////////////////////////////////////////
193 // CollectedCookiesViews, public:
195 CollectedCookiesViews::CollectedCookiesViews(content::WebContents* web_contents)
196 : web_contents_(web_contents),
197 allowed_label_(NULL),
198 blocked_label_(NULL),
199 allowed_cookies_tree_(NULL),
200 blocked_cookies_tree_(NULL),
201 block_allowed_button_(NULL),
202 delete_allowed_button_(NULL),
203 allow_blocked_button_(NULL),
204 for_session_blocked_button_(NULL),
205 cookie_info_view_(NULL),
206 infobar_(NULL),
207 status_changed_(false) {
208 TabSpecificContentSettings* content_settings =
209 TabSpecificContentSettings::FromWebContents(web_contents);
210 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN,
211 content::Source<TabSpecificContentSettings>(content_settings));
212 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
213 WebContentsModalDialogManager::FromWebContents(web_contents);
214 WebContentsModalDialogManagerDelegate* modal_delegate =
215 web_contents_modal_dialog_manager->delegate();
216 DCHECK(modal_delegate);
217 window_ = views::Widget::CreateWindowAsFramelessChild(
218 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView());
219 web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView());
222 ///////////////////////////////////////////////////////////////////////////////
223 // CollectedCookiesViews, views::DialogDelegate implementation:
225 base::string16 CollectedCookiesViews::GetWindowTitle() const {
226 return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_DIALOG_TITLE);
229 int CollectedCookiesViews::GetDialogButtons() const {
230 return ui::DIALOG_BUTTON_CANCEL;
233 base::string16 CollectedCookiesViews::GetDialogButtonLabel(
234 ui::DialogButton button) const {
235 return l10n_util::GetStringUTF16(IDS_CLOSE);
238 void CollectedCookiesViews::DeleteDelegate() {
239 delete this;
242 bool CollectedCookiesViews::Cancel() {
243 if (status_changed_) {
244 CollectedCookiesInfoBarDelegate::Create(
245 InfoBarService::FromWebContents(web_contents_));
248 return true;
251 // TODO(wittman): Remove this override once we move to the new style frame view
252 // on all dialogs.
253 views::NonClientFrameView* CollectedCookiesViews::CreateNonClientFrameView(
254 views::Widget* widget) {
255 return CreateConstrainedStyleNonClientFrameView(
256 widget,
257 web_contents_->GetBrowserContext());
260 ui::ModalType CollectedCookiesViews::GetModalType() const {
261 #if defined(USE_ASH)
262 return ui::MODAL_TYPE_CHILD;
263 #else
264 return views::WidgetDelegate::GetModalType();
265 #endif
268 ///////////////////////////////////////////////////////////////////////////////
269 // CollectedCookiesViews, views::ButtonListener implementation:
271 void CollectedCookiesViews::ButtonPressed(views::Button* sender,
272 const ui::Event& event) {
273 if (sender == block_allowed_button_) {
274 AddContentException(allowed_cookies_tree_, CONTENT_SETTING_BLOCK);
275 } else if (sender == delete_allowed_button_) {
276 allowed_cookies_tree_model_->DeleteCookieNode(
277 static_cast<CookieTreeNode*>(allowed_cookies_tree_->GetSelectedNode()));
278 } else if (sender == allow_blocked_button_) {
279 AddContentException(blocked_cookies_tree_, CONTENT_SETTING_ALLOW);
280 } else if (sender == for_session_blocked_button_) {
281 AddContentException(blocked_cookies_tree_, CONTENT_SETTING_SESSION_ONLY);
285 ///////////////////////////////////////////////////////////////////////////////
286 // CollectedCookiesViews, views::TabbedPaneListener implementation:
288 void CollectedCookiesViews::TabSelectedAt(int index) {
289 EnableControls();
290 ShowCookieInfo();
293 ///////////////////////////////////////////////////////////////////////////////
294 // CollectedCookiesViews, views::TreeViewController implementation:
296 void CollectedCookiesViews::OnTreeViewSelectionChanged(
297 views::TreeView* tree_view) {
298 EnableControls();
299 ShowCookieInfo();
302 ///////////////////////////////////////////////////////////////////////////////
303 // CollectedCookiesViews, views::View overrides:
305 gfx::Size CollectedCookiesViews::GetMinimumSize() {
306 // Allow UpdateWebContentsModalDialogPosition to clamp the dialog width.
307 return gfx::Size(0, View::GetMinimumSize().height());
310 void CollectedCookiesViews::ViewHierarchyChanged(
311 const ViewHierarchyChangedDetails& details) {
312 if (details.is_add && details.child == this)
313 Init();
316 ////////////////////////////////////////////////////////////////////////////////
317 // CollectedCookiesViews, private:
319 CollectedCookiesViews::~CollectedCookiesViews() {
320 allowed_cookies_tree_->SetModel(NULL);
321 blocked_cookies_tree_->SetModel(NULL);
324 void CollectedCookiesViews::Init() {
325 using views::GridLayout;
327 GridLayout* layout = GridLayout::CreatePanel(this);
328 SetLayoutManager(layout);
330 const int single_column_layout_id = 0;
331 views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id);
332 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
333 GridLayout::USE_PREF, 0, 0);
335 layout->StartRow(0, single_column_layout_id);
336 views::TabbedPane* tabbed_pane = new views::TabbedPane();
337 layout->SetInsets(gfx::Insets(kTabbedPaneTopPadding, 0, 0, 0));
339 layout->AddView(tabbed_pane);
340 // NOTE: Panes must be added after |tabbed_pane| has been added to its parent.
341 base::string16 label_allowed = l10n_util::GetStringUTF16(
342 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_TAB_LABEL);
343 base::string16 label_blocked = l10n_util::GetStringUTF16(
344 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_TAB_LABEL);
345 tabbed_pane->AddTab(label_allowed, CreateAllowedPane());
346 tabbed_pane->AddTab(label_blocked, CreateBlockedPane());
347 tabbed_pane->SelectTabAt(0);
348 tabbed_pane->set_listener(this);
349 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
351 layout->StartRow(0, single_column_layout_id);
352 cookie_info_view_ = new CookieInfoView();
353 layout->AddView(cookie_info_view_);
354 layout->AddPaddingRow(0, kCookieInfoBottomPadding);
356 layout->StartRow(0, single_column_layout_id);
357 infobar_ = new InfobarView();
358 layout->AddView(infobar_);
360 EnableControls();
361 ShowCookieInfo();
364 views::View* CollectedCookiesViews::CreateAllowedPane() {
365 TabSpecificContentSettings* content_settings =
366 TabSpecificContentSettings::FromWebContents(web_contents_);
368 // Create the controls that go into the pane.
369 allowed_label_ = new views::Label(l10n_util::GetStringUTF16(
370 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL));
372 const LocalSharedObjectsContainer& allowed_data =
373 content_settings->allowed_local_shared_objects();
374 allowed_cookies_tree_model_ = allowed_data.CreateCookiesTreeModel();
375 allowed_cookies_tree_ = new views::TreeView();
376 allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get());
377 allowed_cookies_tree_->SetRootShown(false);
378 allowed_cookies_tree_->SetEditable(false);
379 allowed_cookies_tree_->set_auto_expand_children(true);
380 allowed_cookies_tree_->SetController(this);
382 block_allowed_button_ = new views::LabelButton(this,
383 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON));
384 block_allowed_button_->SetStyle(views::Button::STYLE_BUTTON);
386 delete_allowed_button_ = new views::LabelButton(this,
387 l10n_util::GetStringUTF16(IDS_COOKIES_REMOVE_LABEL));
388 delete_allowed_button_->SetStyle(views::Button::STYLE_BUTTON);
390 // Create the view that holds all the controls together. This will be the
391 // pane added to the tabbed pane.
392 using views::GridLayout;
394 views::View* pane = new views::View();
395 GridLayout* layout = GridLayout::CreatePanel(pane);
396 layout->SetInsets(kVPanelPadding, views::kButtonHEdgeMarginNew,
397 kVPanelPadding, views::kButtonHEdgeMarginNew);
398 pane->SetLayoutManager(layout);
400 const int single_column_layout_id = 0;
401 views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id);
402 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1,
403 GridLayout::USE_PREF, 0, 0);
405 const int three_columns_layout_id = 1;
406 column_set = layout->AddColumnSet(three_columns_layout_id);
407 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
408 GridLayout::USE_PREF, 0, 0);
409 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
410 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
411 GridLayout::USE_PREF, 0, 0);
413 layout->StartRow(0, single_column_layout_id);
414 layout->AddView(allowed_label_);
415 layout->AddPaddingRow(0, kLabelBottomPadding);
417 layout->StartRow(1, single_column_layout_id);
418 layout->AddView(CreateScrollView(allowed_cookies_tree_), 1, 1,
419 GridLayout::FILL, GridLayout::FILL, kTreeViewWidth,
420 kTreeViewHeight);
421 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
423 layout->StartRow(0, three_columns_layout_id);
424 layout->AddView(block_allowed_button_);
425 layout->AddView(delete_allowed_button_);
427 return pane;
430 views::View* CollectedCookiesViews::CreateBlockedPane() {
431 TabSpecificContentSettings* content_settings =
432 TabSpecificContentSettings::FromWebContents(web_contents_);
434 Profile* profile =
435 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
436 PrefService* prefs = profile->GetPrefs();
438 // Create the controls that go into the pane.
439 blocked_label_ = new views::Label(
440 l10n_util::GetStringUTF16(
441 prefs->GetBoolean(prefs::kBlockThirdPartyCookies) ?
442 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED :
443 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL));
444 blocked_label_->SetMultiLine(true);
445 blocked_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
446 const LocalSharedObjectsContainer& blocked_data =
447 content_settings->blocked_local_shared_objects();
448 blocked_cookies_tree_model_ = blocked_data.CreateCookiesTreeModel();
449 blocked_cookies_tree_ = new views::TreeView();
450 blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get());
451 blocked_cookies_tree_->SetRootShown(false);
452 blocked_cookies_tree_->SetEditable(false);
453 blocked_cookies_tree_->set_auto_expand_children(true);
454 blocked_cookies_tree_->SetController(this);
456 allow_blocked_button_ = new views::LabelButton(this,
457 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON));
458 allow_blocked_button_->SetStyle(views::Button::STYLE_BUTTON);
459 for_session_blocked_button_ = new views::LabelButton(this,
460 l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_SESSION_ONLY_BUTTON));
461 for_session_blocked_button_->SetStyle(views::Button::STYLE_BUTTON);
463 // Create the view that holds all the controls together. This will be the
464 // pane added to the tabbed pane.
465 using views::GridLayout;
467 views::View* pane = new views::View();
468 GridLayout* layout = GridLayout::CreatePanel(pane);
469 layout->SetInsets(kVPanelPadding, views::kButtonHEdgeMarginNew,
470 kVPanelPadding, views::kButtonHEdgeMarginNew);
471 pane->SetLayoutManager(layout);
473 const int single_column_layout_id = 0;
474 views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id);
475 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1,
476 GridLayout::USE_PREF, 0, 0);
478 const int three_columns_layout_id = 1;
479 column_set = layout->AddColumnSet(three_columns_layout_id);
480 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
481 GridLayout::USE_PREF, 0, 0);
482 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
483 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
484 GridLayout::USE_PREF, 0, 0);
486 layout->StartRow(0, single_column_layout_id);
487 layout->AddView(blocked_label_, 1, 1, GridLayout::FILL, GridLayout::FILL);
488 layout->AddPaddingRow(0, kLabelBottomPadding);
490 layout->StartRow(1, single_column_layout_id);
491 layout->AddView(
492 CreateScrollView(blocked_cookies_tree_), 1, 1,
493 GridLayout::FILL, GridLayout::FILL, kTreeViewWidth, kTreeViewHeight);
494 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
496 layout->StartRow(0, three_columns_layout_id);
497 layout->AddView(allow_blocked_button_);
498 layout->AddView(for_session_blocked_button_);
500 return pane;
503 views::View* CollectedCookiesViews::CreateScrollView(views::TreeView* pane) {
504 views::ScrollView* scroll_view = new views::ScrollView();
505 scroll_view->SetContents(pane);
506 scroll_view->set_border(
507 views::Border::CreateSolidBorder(1, kCookiesBorderColor));
508 return scroll_view;
511 void CollectedCookiesViews::EnableControls() {
512 bool enable_allowed_buttons = false;
513 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode();
514 if (node) {
515 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node);
516 if (cookie_node->GetDetailedInfo().node_type ==
517 CookieTreeNode::DetailedInfo::TYPE_HOST) {
518 enable_allowed_buttons = static_cast<CookieTreeHostNode*>(
519 cookie_node)->CanCreateContentException();
522 block_allowed_button_->SetEnabled(enable_allowed_buttons);
523 delete_allowed_button_->SetEnabled(node != NULL);
525 bool enable_blocked_buttons = false;
526 node = blocked_cookies_tree_->GetSelectedNode();
527 if (node) {
528 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node);
529 if (cookie_node->GetDetailedInfo().node_type ==
530 CookieTreeNode::DetailedInfo::TYPE_HOST) {
531 enable_blocked_buttons = static_cast<CookieTreeHostNode*>(
532 cookie_node)->CanCreateContentException();
535 allow_blocked_button_->SetEnabled(enable_blocked_buttons);
536 for_session_blocked_button_->SetEnabled(enable_blocked_buttons);
539 void CollectedCookiesViews::ShowCookieInfo() {
540 ui::TreeModelNode* node = allowed_cookies_tree_->GetSelectedNode();
541 if (!node)
542 node = blocked_cookies_tree_->GetSelectedNode();
544 if (node) {
545 CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node);
546 const CookieTreeNode::DetailedInfo detailed_info =
547 cookie_node->GetDetailedInfo();
549 if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) {
550 cookie_info_view_->SetCookie(detailed_info.cookie->Domain(),
551 *detailed_info.cookie);
552 } else {
553 cookie_info_view_->ClearCookieDisplay();
555 } else {
556 cookie_info_view_->ClearCookieDisplay();
560 void CollectedCookiesViews::AddContentException(views::TreeView* tree_view,
561 ContentSetting setting) {
562 CookieTreeHostNode* host_node =
563 static_cast<CookieTreeHostNode*>(tree_view->GetSelectedNode());
564 Profile* profile =
565 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
566 host_node->CreateContentException(
567 CookieSettings::Factory::GetForProfile(profile).get(), setting);
568 infobar_->UpdateVisibility(true, setting, host_node->GetTitle());
569 status_changed_ = true;
572 ///////////////////////////////////////////////////////////////////////////////
573 // CollectedCookiesViews, content::NotificationObserver implementation:
575 void CollectedCookiesViews::Observe(
576 int type,
577 const content::NotificationSource& source,
578 const content::NotificationDetails& details) {
579 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type);
580 window_->Close();