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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 return is_popup_showing; | 307 return is_popup_showing; |
308 } | 308 } |
309 | 309 |
310 WebsiteSettingsPopupView::WebsiteSettingsPopupView( | 310 WebsiteSettingsPopupView::WebsiteSettingsPopupView( |
311 views::View* anchor_view, | 311 views::View* anchor_view, |
312 gfx::NativeView parent_window, | 312 gfx::NativeView parent_window, |
313 Profile* profile, | 313 Profile* profile, |
314 content::WebContents* web_contents, | 314 content::WebContents* web_contents, |
315 const GURL& url, | 315 const GURL& url, |
316 const content::SSLStatus& ssl) | 316 const content::SSLStatus& ssl) |
317 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), | 317 : content::WebContentsObserver(web_contents), |
| 318 BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
318 web_contents_(web_contents), | 319 web_contents_(web_contents), |
319 header_(nullptr), | 320 header_(nullptr), |
320 tabbed_pane_(nullptr), | 321 tabbed_pane_(nullptr), |
321 permissions_tab_(nullptr), | 322 permissions_tab_(nullptr), |
322 site_data_content_(nullptr), | 323 site_data_content_(nullptr), |
323 cookie_dialog_link_(nullptr), | 324 cookie_dialog_link_(nullptr), |
324 permissions_content_(nullptr), | 325 permissions_content_(nullptr), |
325 connection_tab_(nullptr), | 326 connection_tab_(nullptr), |
326 identity_info_content_(nullptr), | 327 identity_info_content_(nullptr), |
327 certificate_dialog_link_(nullptr), | 328 certificate_dialog_link_(nullptr), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 connection_tab_); | 374 connection_tab_); |
374 DCHECK_EQ(tabbed_pane_->GetTabCount(), NUM_TAB_IDS); | 375 DCHECK_EQ(tabbed_pane_->GetTabCount(), NUM_TAB_IDS); |
375 tabbed_pane_->set_listener(this); | 376 tabbed_pane_->set_listener(this); |
376 | 377 |
377 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, | 378 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, |
378 kPopupMarginBottom, kPopupMarginRight)); | 379 kPopupMarginBottom, kPopupMarginRight)); |
379 | 380 |
380 views::BubbleDelegateView::CreateBubble(this); | 381 views::BubbleDelegateView::CreateBubble(this); |
381 | 382 |
382 presenter_.reset(new WebsiteSettings( | 383 presenter_.reset(new WebsiteSettings( |
383 this, profile, | 384 this, profile, TabSpecificContentSettings::FromWebContents(web_contents), |
384 TabSpecificContentSettings::FromWebContents(web_contents), | 385 web_contents, url, ssl, content::CertStore::GetInstance())); |
385 InfoBarService::FromWebContents(web_contents), url, ssl, | 386 } |
386 content::CertStore::GetInstance())); | 387 |
| 388 void WebsiteSettingsPopupView::RenderFrameDeleted( |
| 389 content::RenderFrameHost* render_frame_host) { |
| 390 if (render_frame_host == web_contents_->GetMainFrame()) { |
| 391 GetWidget()->Close(); |
| 392 } |
387 } | 393 } |
388 | 394 |
389 void WebsiteSettingsPopupView::OnPermissionChanged( | 395 void WebsiteSettingsPopupView::OnPermissionChanged( |
390 const WebsiteSettingsUI::PermissionInfo& permission) { | 396 const WebsiteSettingsUI::PermissionInfo& permission) { |
391 presenter_->OnSitePermissionChanged(permission.type, permission.setting); | 397 presenter_->OnSitePermissionChanged(permission.type, permission.setting); |
392 } | 398 } |
393 | 399 |
394 void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) { | 400 void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) { |
395 is_popup_showing = false; | 401 is_popup_showing = false; |
396 presenter_->OnUIClosing(); | 402 presenter_->OnUIClosing(); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 // desktop we should link to that here, too. | 830 // desktop we should link to that here, too. |
825 web_contents_->OpenURL(content::OpenURLParams( | 831 web_contents_->OpenURL(content::OpenURLParams( |
826 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), | 832 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), |
827 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); | 833 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); |
828 presenter_->RecordWebsiteSettingsAction( | 834 presenter_->RecordWebsiteSettingsAction( |
829 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); | 835 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); |
830 } else { | 836 } else { |
831 NOTREACHED(); | 837 NOTREACHED(); |
832 } | 838 } |
833 } | 839 } |
OLD | NEW |