| 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/website_settings/website_settings_popup_view.h
" | 5 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/strings/string_number_conversions.h" | |
| 16 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chrome/browser/certificate_viewer.h" | 17 #include "chrome/browser/certificate_viewer.h" |
| 19 #include "chrome/browser/devtools/devtools_toggle_action.h" | 18 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 20 #include "chrome/browser/devtools/devtools_window.h" | 19 #include "chrome/browser/devtools/devtools_window.h" |
| 21 #include "chrome/browser/infobars/infobar_service.h" | 20 #include "chrome/browser/infobars/infobar_service.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_dialogs.h" | 23 #include "chrome/browser/ui/browser_dialogs.h" |
| 25 #include "chrome/browser/ui/layout_constants.h" | 24 #include "chrome/browser/ui/layout_constants.h" |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 547 |
| 549 void WebsiteSettingsPopupView::SetCookieInfo( | 548 void WebsiteSettingsPopupView::SetCookieInfo( |
| 550 const CookieInfoList& cookie_info_list) { | 549 const CookieInfoList& cookie_info_list) { |
| 551 // |cookie_info_list| should only ever have 2 items: first- and third-party | 550 // |cookie_info_list| should only ever have 2 items: first- and third-party |
| 552 // cookies. | 551 // cookies. |
| 553 DCHECK_EQ(cookie_info_list.size(), 2u); | 552 DCHECK_EQ(cookie_info_list.size(), 2u); |
| 554 base::string16 first_party_label_text; | 553 base::string16 first_party_label_text; |
| 555 base::string16 third_party_label_text; | 554 base::string16 third_party_label_text; |
| 556 for (const auto& i : cookie_info_list) { | 555 for (const auto& i : cookie_info_list) { |
| 557 if (i.is_first_party) { | 556 if (i.is_first_party) { |
| 558 first_party_label_text = | 557 first_party_label_text = l10n_util::GetPluralStringFUTF16( |
| 559 l10n_util::GetStringFUTF16(IDS_WEBSITE_SETTINGS_FIRST_PARTY_SITE_DATA, | 558 IDS_WEBSITE_SETTINGS_FIRST_PARTY_SITE_DATA, i.allowed); |
| 560 base::IntToString16(i.allowed)); | |
| 561 } else { | 559 } else { |
| 562 third_party_label_text = | 560 third_party_label_text = l10n_util::GetPluralStringFUTF16( |
| 563 l10n_util::GetStringFUTF16(IDS_WEBSITE_SETTINGS_THIRD_PARTY_SITE_DATA, | 561 IDS_WEBSITE_SETTINGS_THIRD_PARTY_SITE_DATA, i.allowed); |
| 564 base::IntToString16(i.allowed)); | |
| 565 } | 562 } |
| 566 } | 563 } |
| 567 | 564 |
| 568 if (!cookie_dialog_link_) { | 565 if (!cookie_dialog_link_) { |
| 569 cookie_dialog_link_ = new views::Link(first_party_label_text); | 566 cookie_dialog_link_ = new views::Link(first_party_label_text); |
| 570 cookie_dialog_link_->set_listener(this); | 567 cookie_dialog_link_->set_listener(this); |
| 571 } else { | 568 } else { |
| 572 cookie_dialog_link_->SetText(first_party_label_text); | 569 cookie_dialog_link_->SetText(first_party_label_text); |
| 573 } | 570 } |
| 574 | 571 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 gfx::NativeWindow parent = | 812 gfx::NativeWindow parent = |
| 816 anchor_widget() ? anchor_widget()->GetNativeWindow() : nullptr; | 813 anchor_widget() ? anchor_widget()->GetNativeWindow() : nullptr; |
| 817 presenter_->RecordWebsiteSettingsAction( | 814 presenter_->RecordWebsiteSettingsAction( |
| 818 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); | 815 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); |
| 819 ShowCertificateViewerByID(web_contents_, parent, cert_id_); | 816 ShowCertificateViewerByID(web_contents_, parent, cert_id_); |
| 820 } else { | 817 } else { |
| 821 DevToolsWindow::OpenDevToolsWindow( | 818 DevToolsWindow::OpenDevToolsWindow( |
| 822 web_contents_, DevToolsToggleAction::ShowSecurityPanel()); | 819 web_contents_, DevToolsToggleAction::ShowSecurityPanel()); |
| 823 } | 820 } |
| 824 } | 821 } |
| OLD | NEW |