| 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 |
| 395 new CollectedCookiesViews(web_contents_); | 396 new CollectedCookiesViews(web_contents_); |
| 396 } else if (source == certificate_dialog_link_) { | 397 } else if (source == certificate_dialog_link_) { |
| 397 gfx::NativeWindow parent = GetAnchorView() ? | 398 gfx::NativeWindow parent = GetAnchorView() ? |
| 398 GetAnchorView()->GetWidget()->GetNativeWindow() : NULL; | 399 GetAnchorView()->GetWidget()->GetNativeWindow() : NULL; |
| 400 presenter_->RecordWebsiteSettingsAction( |
| 401 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); |
| 399 ShowCertificateViewerByID(web_contents_, parent, cert_id_); | 402 ShowCertificateViewerByID(web_contents_, parent, cert_id_); |
| 400 } else if (source == signed_certificate_timestamps_link_) { | 403 } else if (source == signed_certificate_timestamps_link_) { |
| 401 chrome::ShowSignedCertificateTimestampsViewer( | 404 chrome::ShowSignedCertificateTimestampsViewer( |
| 402 web_contents_, signed_certificate_timestamp_ids_); | 405 web_contents_, signed_certificate_timestamp_ids_); |
| 406 presenter_->RecordWebsiteSettingsAction( |
| 407 WebsiteSettings::WEBSITE_SETTINGS_TRANSPARENCY_VIEWER_OPENED); |
| 403 } else if (source == help_center_link_) { | 408 } else if (source == help_center_link_) { |
| 404 browser_->OpenURL( | 409 browser_->OpenURL( |
| 405 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), | 410 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), |
| 406 content::Referrer(), | 411 content::Referrer(), |
| 407 NEW_FOREGROUND_TAB, | 412 NEW_FOREGROUND_TAB, |
| 408 ui::PAGE_TRANSITION_LINK, | 413 ui::PAGE_TRANSITION_LINK, |
| 409 false)); | 414 false)); |
| 415 presenter_->RecordWebsiteSettingsAction( |
| 416 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
| 410 } | 417 } |
| 411 } | 418 } |
| 412 | 419 |
| 413 void WebsiteSettingsPopupView::TabSelectedAt(int index) { | 420 void WebsiteSettingsPopupView::TabSelectedAt(int index) { |
| 421 switch (index) { |
| 422 case TAB_ID_PERMISSIONS: |
| 423 presenter_->RecordWebsiteSettingsAction( |
| 424 WebsiteSettings::WEBSITE_SETTINGS_PERMISSIONS_TAB_SELECTED); |
| 425 break; |
| 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 default: |
| 436 NOTREACHED(); |
| 437 } |
| 414 tabbed_pane_->GetSelectedTab()->Layout(); | 438 tabbed_pane_->GetSelectedTab()->Layout(); |
| 415 SizeToContents(); | 439 SizeToContents(); |
| 416 } | 440 } |
| 417 | 441 |
| 418 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { | 442 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { |
| 419 if (header_ == NULL && tabbed_pane_ == NULL) | 443 if (header_ == NULL && tabbed_pane_ == NULL) |
| 420 return views::View::GetPreferredSize(); | 444 return views::View::GetPreferredSize(); |
| 421 | 445 |
| 422 int height = 0; | 446 int height = 0; |
| 423 if (header_) | 447 if (header_) |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 831 |
| 808 if (reset_decisions_button) { | 832 if (reset_decisions_button) { |
| 809 content_layout->StartRow(1, 0); | 833 content_layout->StartRow(1, 0); |
| 810 content_layout->AddView(reset_decisions_button); | 834 content_layout->AddView(reset_decisions_button); |
| 811 } | 835 } |
| 812 | 836 |
| 813 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, | 837 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, |
| 814 views::GridLayout::LEADING); | 838 views::GridLayout::LEADING); |
| 815 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); | 839 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); |
| 816 } | 840 } |
| OLD | NEW |