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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 const ui::Event& event) { | 383 const ui::Event& event) { |
384 if (button == reset_decisions_button_) | 384 if (button == reset_decisions_button_) |
385 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 385 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
386 GetWidget()->Close(); | 386 GetWidget()->Close(); |
387 } | 387 } |
388 | 388 |
389 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, | 389 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, |
390 int event_flags) { | 390 int event_flags) { |
391 if (source == cookie_dialog_link_) { | 391 if (source == cookie_dialog_link_) { |
392 // Count how often the Collected Cookies dialog is opened. | 392 // Count how often the Collected Cookies dialog is opened. |
393 content::RecordAction( | 393 presenter_->RecordWebsiteSettingsAction( |
394 base::UserMetricsAction("WebsiteSettings_CookiesDialogOpened")); | 394 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); |
395 new CollectedCookiesViews(web_contents_); | 395 new CollectedCookiesViews(web_contents_); |
396 } else if (source == certificate_dialog_link_) { | 396 } else if (source == certificate_dialog_link_) { |
397 gfx::NativeWindow parent = GetAnchorView() ? | 397 gfx::NativeWindow parent = GetAnchorView() ? |
398 GetAnchorView()->GetWidget()->GetNativeWindow() : NULL; | 398 GetAnchorView()->GetWidget()->GetNativeWindow() : NULL; |
399 presenter_->RecordWebsiteSettingsAction( | |
400 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); | |
399 ShowCertificateViewerByID(web_contents_, parent, cert_id_); | 401 ShowCertificateViewerByID(web_contents_, parent, cert_id_); |
400 } else if (source == signed_certificate_timestamps_link_) { | 402 } else if (source == signed_certificate_timestamps_link_) { |
401 chrome::ShowSignedCertificateTimestampsViewer( | 403 chrome::ShowSignedCertificateTimestampsViewer( |
402 web_contents_, signed_certificate_timestamp_ids_); | 404 web_contents_, signed_certificate_timestamp_ids_); |
405 presenter_->RecordWebsiteSettingsAction( | |
406 WebsiteSettings::WEBSITE_SETTINGS_TRANSPARENCY_VIEWER_OPENED); | |
403 } else if (source == help_center_link_) { | 407 } else if (source == help_center_link_) { |
404 browser_->OpenURL( | 408 browser_->OpenURL( |
405 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), | 409 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), |
406 content::Referrer(), | 410 content::Referrer(), |
407 NEW_FOREGROUND_TAB, | 411 NEW_FOREGROUND_TAB, |
408 ui::PAGE_TRANSITION_LINK, | 412 ui::PAGE_TRANSITION_LINK, |
409 false)); | 413 false)); |
414 presenter_->RecordWebsiteSettingsAction( | |
415 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); | |
410 } | 416 } |
411 } | 417 } |
412 | 418 |
413 void WebsiteSettingsPopupView::TabSelectedAt(int index) { | 419 void WebsiteSettingsPopupView::TabSelectedAt(int index) { |
420 switch (index) { | |
421 case TAB_ID_PERMISSIONS: { | |
422 presenter_->RecordWebsiteSettingsAction( | |
423 WebsiteSettings::WEBSITE_SETTINGS_PERMISSIONS_TAB_SELECTED); | |
424 break; | |
425 } | |
Ilya Sherman
2014/10/29 23:55:42
nit: No need for curly braces for case stmts.
lgarron
2014/10/31 00:50:47
Acknowledged.
| |
426 case TAB_ID_CONNECTION: { | |
427 // If the Connection tab is selected first, we're still inside the | |
428 // construction of presenter_. In that case, the action is already logged | |
429 // by WEBSITE_SETTINGS_CONNECTION_TAB_SHOWN_IMMEDIATELY. | |
430 if (presenter_) { | |
431 presenter_->RecordWebsiteSettingsAction( | |
432 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_TAB_SELECTED); | |
433 } | |
434 break; | |
435 } | |
436 default: { | |
437 assert(false); | |
Ilya Sherman
2014/10/29 23:55:42
nit: Did you mean "NOTREACHED()"?
lgarron
2014/10/30 00:10:19
For this and the braces, I was following the C++ s
Ilya Sherman
2014/10/30 01:32:56
Note that the style guide says "case blocks in swi
lgarron
2014/10/31 00:50:47
Acknowledged.
| |
438 } | |
439 } | |
414 tabbed_pane_->GetSelectedTab()->Layout(); | 440 tabbed_pane_->GetSelectedTab()->Layout(); |
415 SizeToContents(); | 441 SizeToContents(); |
416 } | 442 } |
417 | 443 |
418 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { | 444 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { |
419 if (header_ == NULL && tabbed_pane_ == NULL) | 445 if (header_ == NULL && tabbed_pane_ == NULL) |
420 return views::View::GetPreferredSize(); | 446 return views::View::GetPreferredSize(); |
421 | 447 |
422 int height = 0; | 448 int height = 0; |
423 if (header_) | 449 if (header_) |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 | 833 |
808 if (reset_decisions_button) { | 834 if (reset_decisions_button) { |
809 content_layout->StartRow(1, 0); | 835 content_layout->StartRow(1, 0); |
810 content_layout->AddView(reset_decisions_button); | 836 content_layout->AddView(reset_decisions_button); |
811 } | 837 } |
812 | 838 |
813 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, | 839 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, |
814 views::GridLayout::LEADING); | 840 views::GridLayout::LEADING); |
815 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); | 841 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); |
816 } | 842 } |
OLD | NEW |