| 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 #include "chrome/browser/ui/views/collected_cookies_views.h" | 5 #include "chrome/browser/ui/views/collected_cookies_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/api/infobars/infobar_service.h" | 7 #include "chrome/browser/api/infobars/infobar_service.h" |
| 8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "ui/views/controls/button/text_button.h" | 37 #include "ui/views/controls/button/text_button.h" |
| 38 #include "ui/views/controls/image_view.h" | 38 #include "ui/views/controls/image_view.h" |
| 39 #include "ui/views/controls/label.h" | 39 #include "ui/views/controls/label.h" |
| 40 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 40 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
| 41 #include "ui/views/controls/tree/tree_view.h" | 41 #include "ui/views/controls/tree/tree_view.h" |
| 42 #include "ui/views/layout/box_layout.h" | 42 #include "ui/views/layout/box_layout.h" |
| 43 #include "ui/views/layout/grid_layout.h" | 43 #include "ui/views/layout/grid_layout.h" |
| 44 #include "ui/views/layout/layout_constants.h" | 44 #include "ui/views/layout/layout_constants.h" |
| 45 #include "ui/views/widget/widget.h" | 45 #include "ui/views/widget/widget.h" |
| 46 | 46 |
| 47 // TODO(markusheintz): This should be removed once the native Windows tabbed | |
| 48 // pane is not used anymore (http://crbug.com/138059) | |
| 49 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 50 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_win.h" | |
| 51 #endif | |
| 52 | |
| 53 namespace chrome { | 47 namespace chrome { |
| 54 | 48 |
| 55 // Declared in browser_dialogs.h so others don't have to depend on our header. | 49 // Declared in browser_dialogs.h so others don't have to depend on our header. |
| 56 void ShowCollectedCookiesDialog(content::WebContents* web_contents) { | 50 void ShowCollectedCookiesDialog(content::WebContents* web_contents) { |
| 57 // Deletes itself on close. | 51 // Deletes itself on close. |
| 58 new CollectedCookiesViews(web_contents); | 52 new CollectedCookiesViews(web_contents); |
| 59 } | 53 } |
| 60 | 54 |
| 61 } // namespace chrome | 55 } // namespace chrome |
| 62 | 56 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 using views::GridLayout; | 284 using views::GridLayout; |
| 291 | 285 |
| 292 GridLayout* layout = GridLayout::CreatePanel(this); | 286 GridLayout* layout = GridLayout::CreatePanel(this); |
| 293 SetLayoutManager(layout); | 287 SetLayoutManager(layout); |
| 294 | 288 |
| 295 const int single_column_layout_id = 0; | 289 const int single_column_layout_id = 0; |
| 296 views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id); | 290 views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id); |
| 297 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 291 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 298 GridLayout::USE_PREF, 0, 0); | 292 GridLayout::USE_PREF, 0, 0); |
| 299 | 293 |
| 300 const int single_column_with_padding_layout_id = 1; | |
| 301 views::ColumnSet* column_set_with_padding = layout->AddColumnSet( | |
| 302 single_column_with_padding_layout_id); | |
| 303 column_set_with_padding->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | |
| 304 GridLayout::USE_PREF, 0, 0); | |
| 305 column_set_with_padding->AddPaddingColumn(0, 2); | |
| 306 | |
| 307 layout->StartRow(0, single_column_layout_id); | 294 layout->StartRow(0, single_column_layout_id); |
| 308 views::TabbedPane* tabbed_pane = new views::TabbedPane(); | 295 views::TabbedPane* tabbed_pane = new views::TabbedPane(); |
| 309 #if defined(OS_WIN) && !defined(USE_AURA) | 296 // This color matches native_tabbed_pane_views.cc's kTabBorderColor. |
| 310 // "set_use_native_win_control" must be called before the first tab is added. | 297 const SkColor border_color = SkColorSetRGB(0xCC, 0xCC, 0xCC); |
| 311 tabbed_pane->set_use_native_win_control(true); | 298 // TODO(msw): Remove border and expand bounds in new dialog style. |
| 312 #endif | 299 tabbed_pane->set_border(views::Border::CreateSolidBorder(1, border_color)); |
| 300 |
| 313 layout->AddView(tabbed_pane); | 301 layout->AddView(tabbed_pane); |
| 314 // NOTE: the panes need to be added after the tabbed_pane has been added to | 302 // NOTE: Panes must be added after |tabbed_pane| has been added to its parent. |
| 315 // its parent. | |
| 316 string16 label_allowed = l10n_util::GetStringUTF16( | 303 string16 label_allowed = l10n_util::GetStringUTF16( |
| 317 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_TAB_LABEL); | 304 IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_TAB_LABEL); |
| 318 string16 label_blocked = l10n_util::GetStringUTF16( | 305 string16 label_blocked = l10n_util::GetStringUTF16( |
| 319 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_TAB_LABEL); | 306 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_TAB_LABEL); |
| 320 tabbed_pane->AddTab(label_allowed, CreateAllowedPane()); | 307 tabbed_pane->AddTab(label_allowed, CreateAllowedPane()); |
| 321 tabbed_pane->AddTab(label_blocked, CreateBlockedPane()); | 308 tabbed_pane->AddTab(label_blocked, CreateBlockedPane()); |
| 322 tabbed_pane->SelectTabAt(0); | 309 tabbed_pane->SelectTabAt(0); |
| 323 tabbed_pane->set_listener(this); | 310 tabbed_pane->set_listener(this); |
| 324 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 311 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 325 | 312 |
| 326 layout->StartRow(0, single_column_with_padding_layout_id); | 313 layout->StartRow(0, single_column_layout_id); |
| 327 cookie_info_view_ = new CookieInfoView(false); | 314 cookie_info_view_ = new CookieInfoView(false); |
| 328 layout->AddView(cookie_info_view_); | 315 layout->AddView(cookie_info_view_); |
| 329 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 316 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 330 | 317 |
| 331 layout->StartRow(0, single_column_with_padding_layout_id); | 318 layout->StartRow(0, single_column_layout_id); |
| 332 infobar_ = new InfobarView(); | 319 infobar_ = new InfobarView(); |
| 333 layout->AddView(infobar_); | 320 layout->AddView(infobar_); |
| 334 | 321 |
| 335 EnableControls(); | 322 EnableControls(); |
| 336 ShowCookieInfo(); | 323 ShowCookieInfo(); |
| 337 } | 324 } |
| 338 | 325 |
| 339 views::View* CollectedCookiesViews::CreateAllowedPane() { | 326 views::View* CollectedCookiesViews::CreateAllowedPane() { |
| 340 TabSpecificContentSettings* content_settings = | 327 TabSpecificContentSettings* content_settings = |
| 341 TabSpecificContentSettings::FromWebContents(web_contents_); | 328 TabSpecificContentSettings::FromWebContents(web_contents_); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 /////////////////////////////////////////////////////////////////////////////// | 508 /////////////////////////////////////////////////////////////////////////////// |
| 522 // CollectedCookiesViews, content::NotificationObserver implementation: | 509 // CollectedCookiesViews, content::NotificationObserver implementation: |
| 523 | 510 |
| 524 void CollectedCookiesViews::Observe( | 511 void CollectedCookiesViews::Observe( |
| 525 int type, | 512 int type, |
| 526 const content::NotificationSource& source, | 513 const content::NotificationSource& source, |
| 527 const content::NotificationDetails& details) { | 514 const content::NotificationDetails& details) { |
| 528 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); | 515 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); |
| 529 window_->CloseWebContentsModalDialog(); | 516 window_->CloseWebContentsModalDialog(); |
| 530 } | 517 } |
| OLD | NEW |