| 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 "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/certificate_viewer.h" | 9 #include "chrome/browser/certificate_viewer.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 tab_contents->infobar_tab_helper(), | 327 tab_contents->infobar_tab_helper(), |
| 328 url, | 328 url, |
| 329 ssl, | 329 ssl, |
| 330 content::CertStore::GetInstance())); | 330 content::CertStore::GetInstance())); |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 void WebsiteSettingsPopupView::OnPermissionChanged( | 334 void WebsiteSettingsPopupView::OnPermissionChanged( |
| 335 PermissionSelectorView* permission_selector) { | 335 PermissionSelectorView* permission_selector) { |
| 336 DCHECK(permission_selector); | 336 DCHECK(permission_selector); |
| 337 // It's not necessary to check that the |presenter_| is not NULL since for |
| 338 // internal chrome pages OnPermissionChanged can't be called. |
| 337 presenter_->OnSitePermissionChanged( | 339 presenter_->OnSitePermissionChanged( |
| 338 permission_selector->GetPermissionType(), | 340 permission_selector->GetPermissionType(), |
| 339 permission_selector->GetSelectedSetting()); | 341 permission_selector->GetSelectedSetting()); |
| 340 } | 342 } |
| 341 | 343 |
| 342 gfx::Rect WebsiteSettingsPopupView::GetAnchorRect() { | 344 gfx::Rect WebsiteSettingsPopupView::GetAnchorRect() { |
| 343 // Compensate for some built-in padding in the icon. This will make the arrow | 345 // Compensate for some built-in padding in the icon. This will make the arrow |
| 344 // point to the middle of the icon. | 346 // point to the middle of the icon. |
| 345 gfx::Rect anchor(BubbleDelegateView::GetAnchorRect()); | 347 gfx::Rect anchor(BubbleDelegateView::GetAnchorRect()); |
| 346 anchor.Inset(0, anchor_view() ? kLocationIconBottomMargin : 0); | 348 anchor.Inset(0, anchor_view() ? kLocationIconBottomMargin : 0); |
| 347 return anchor; | 349 return anchor; |
| 348 } | 350 } |
| 349 | 351 |
| 350 void WebsiteSettingsPopupView::OnWidgetClosing(views::Widget* widget) { | 352 void WebsiteSettingsPopupView::OnWidgetClosing(views::Widget* widget) { |
| 351 presenter_->OnUIClosing(); | 353 if (presenter_.get()) |
| 354 presenter_->OnUIClosing(); |
| 352 } | 355 } |
| 353 | 356 |
| 354 void WebsiteSettingsPopupView::ButtonPressed( | 357 void WebsiteSettingsPopupView::ButtonPressed( |
| 355 views::Button* button, | 358 views::Button* button, |
| 356 const views::Event& event) { | 359 const views::Event& event) { |
| 357 GetWidget()->Close(); | 360 GetWidget()->Close(); |
| 358 } | 361 } |
| 359 | 362 |
| 360 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, | 363 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, |
| 361 int event_flags) { | 364 int event_flags) { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 698 |
| 696 if (link) { | 699 if (link) { |
| 697 content_layout->StartRow(1, 0); | 700 content_layout->StartRow(1, 0); |
| 698 content_layout->AddView(link); | 701 content_layout->AddView(link); |
| 699 } | 702 } |
| 700 | 703 |
| 701 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, | 704 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, |
| 702 views::GridLayout::LEADING); | 705 views::GridLayout::LEADING); |
| 703 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); | 706 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); |
| 704 } | 707 } |
| OLD | NEW |