| 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/gtk/website_settings_popup_gtk.h" | 5 #include "chrome/browser/ui/gtk/website_settings_popup_gtk.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/certificate_viewer.h" | 10 #include "chrome/browser/certificate_viewer.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" | 13 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 14 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 14 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 15 #include "chrome/browser/ui/gtk/collected_cookies_gtk.h" | 15 #include "chrome/browser/ui/gtk/collected_cookies_gtk.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 19 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 19 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 21 #include "chrome/browser/ui/website_settings/website_settings.h" | 21 #include "chrome/browser/ui/website_settings/website_settings.h" |
| 22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 23 #include "content/public/browser/cert_store.h" | 23 #include "content/public/browser/cert_store.h" |
| 24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 26 #include "grit/locale_settings.h" | 26 #include "grit/locale_settings.h" |
| 27 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 28 #include "ui/base/gtk/gtk_hig_constants.h" | 28 #include "ui/base/gtk/gtk_hig_constants.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 NOTREACHED(); | 65 NOTREACHED(); |
| 66 return ""; | 66 return ""; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 // static | 72 // static |
| 73 void WebsiteSettingsPopupGtk::Show(gfx::NativeWindow parent, | 73 void WebsiteSettingsPopupGtk::Show(gfx::NativeWindow parent, |
| 74 Profile* profile, | 74 Profile* profile, |
| 75 TabContentsWrapper* tab_contents_wrapper, | 75 TabContents* tab_contents, |
| 76 const GURL& url, | 76 const GURL& url, |
| 77 const content::SSLStatus& ssl) { | 77 const content::SSLStatus& ssl) { |
| 78 new WebsiteSettingsPopupGtk(parent, profile, tab_contents_wrapper, url, ssl); | 78 new WebsiteSettingsPopupGtk(parent, profile, tab_contents, url, ssl); |
| 79 } | 79 } |
| 80 | 80 |
| 81 WebsiteSettingsPopupGtk::WebsiteSettingsPopupGtk( | 81 WebsiteSettingsPopupGtk::WebsiteSettingsPopupGtk( |
| 82 gfx::NativeWindow parent, | 82 gfx::NativeWindow parent, |
| 83 Profile* profile, | 83 Profile* profile, |
| 84 TabContentsWrapper* tab_contents_wrapper, | 84 TabContents* tab_contents, |
| 85 const GURL& url, | 85 const GURL& url, |
| 86 const content::SSLStatus& ssl) | 86 const content::SSLStatus& ssl) |
| 87 : parent_(parent), | 87 : parent_(parent), |
| 88 contents_(NULL), | 88 contents_(NULL), |
| 89 theme_service_(GtkThemeService::GetFrom(profile)), | 89 theme_service_(GtkThemeService::GetFrom(profile)), |
| 90 profile_(profile), | 90 profile_(profile), |
| 91 tab_contents_wrapper_(tab_contents_wrapper), | 91 tab_contents_(tab_contents), |
| 92 browser_(NULL), | 92 browser_(NULL), |
| 93 cert_id_(0), | 93 cert_id_(0), |
| 94 header_box_(NULL), | 94 header_box_(NULL), |
| 95 cookies_section_contents_(NULL), | 95 cookies_section_contents_(NULL), |
| 96 permissions_section_contents_(NULL), | 96 permissions_section_contents_(NULL), |
| 97 identity_tab_contents_(NULL), | 97 identity_tab_contents_(NULL), |
| 98 first_visit_contents_(NULL), | 98 first_visit_contents_(NULL), |
| 99 presenter_(NULL) { | 99 presenter_(NULL) { |
| 100 BrowserWindowGtk* browser_window = | 100 BrowserWindowGtk* browser_window = |
| 101 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); | 101 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 116 BubbleGtk::POPUP_WINDOW | | 116 BubbleGtk::POPUP_WINDOW | |
| 117 BubbleGtk::GRAB_INPUT, | 117 BubbleGtk::GRAB_INPUT, |
| 118 theme_service_, | 118 theme_service_, |
| 119 this); // |delegate| | 119 this); // |delegate| |
| 120 if (!bubble_) { | 120 if (!bubble_) { |
| 121 NOTREACHED(); | 121 NOTREACHED(); |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 | 124 |
| 125 presenter_.reset(new WebsiteSettings(this, profile, | 125 presenter_.reset(new WebsiteSettings(this, profile, |
| 126 tab_contents_wrapper->content_settings(), | 126 tab_contents->content_settings(), |
| 127 url, ssl, | 127 url, ssl, |
| 128 content::CertStore::GetInstance())); | 128 content::CertStore::GetInstance())); |
| 129 } | 129 } |
| 130 | 130 |
| 131 WebsiteSettingsPopupGtk::~WebsiteSettingsPopupGtk() { | 131 WebsiteSettingsPopupGtk::~WebsiteSettingsPopupGtk() { |
| 132 } | 132 } |
| 133 | 133 |
| 134 void WebsiteSettingsPopupGtk::BubbleClosing(BubbleGtk* bubble, | 134 void WebsiteSettingsPopupGtk::BubbleClosing(BubbleGtk* bubble, |
| 135 bool closed_by_escape) { | 135 bool closed_by_escape) { |
| 136 if (presenter_.get()) | 136 if (presenter_.get()) |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 // (otherwise, GTK won't activate our widgets when the user clicks in them). | 492 // (otherwise, GTK won't activate our widgets when the user clicks in them). |
| 493 gboolean popup_shown = FALSE; | 493 gboolean popup_shown = FALSE; |
| 494 g_object_get(G_OBJECT(GTK_COMBO_BOX(widget)), "popup-shown", &popup_shown, | 494 g_object_get(G_OBJECT(GTK_COMBO_BOX(widget)), "popup-shown", &popup_shown, |
| 495 NULL); | 495 NULL); |
| 496 if (!popup_shown) | 496 if (!popup_shown) |
| 497 bubble_->HandlePointerAndKeyboardUngrabbedByContent(); | 497 bubble_->HandlePointerAndKeyboardUngrabbedByContent(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { | 500 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { |
| 501 new CollectedCookiesGtk(GTK_WINDOW(parent_), | 501 new CollectedCookiesGtk(GTK_WINDOW(parent_), |
| 502 tab_contents_wrapper_); | 502 tab_contents_); |
| 503 bubble_->Close(); | 503 bubble_->Close(); |
| 504 } | 504 } |
| 505 | 505 |
| 506 void WebsiteSettingsPopupGtk::OnPermissionsSettingsLinkClicked( | 506 void WebsiteSettingsPopupGtk::OnPermissionsSettingsLinkClicked( |
| 507 GtkWidget* widget) { | 507 GtkWidget* widget) { |
| 508 browser_->OpenURL(OpenURLParams( | 508 browser_->OpenURL(OpenURLParams( |
| 509 GURL(std::string( | 509 GURL(std::string( |
| 510 chrome::kChromeUISettingsURL) + chrome::kContentSettingsSubPage), | 510 chrome::kChromeUISettingsURL) + chrome::kContentSettingsSubPage), |
| 511 content::Referrer(), | 511 content::Referrer(), |
| 512 NEW_FOREGROUND_TAB, | 512 NEW_FOREGROUND_TAB, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 529 if (presenter_.get()) | 529 if (presenter_.get()) |
| 530 presenter_->OnSitePermissionChanged(ContentSettingsType(type), | 530 presenter_->OnSitePermissionChanged(ContentSettingsType(type), |
| 531 ContentSetting(value)); | 531 ContentSetting(value)); |
| 532 } | 532 } |
| 533 | 533 |
| 534 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { | 534 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { |
| 535 DCHECK_NE(cert_id_, 0); | 535 DCHECK_NE(cert_id_, 0); |
| 536 ShowCertificateViewerByID(GTK_WINDOW(parent_), cert_id_); | 536 ShowCertificateViewerByID(GTK_WINDOW(parent_), cert_id_); |
| 537 bubble_->Close(); | 537 bubble_->Close(); |
| 538 } | 538 } |
| OLD | NEW |