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