Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: chrome/browser/ui/gtk/web_intent_picker_gtk.cc

Issue 11141037: Disable delegation to picker controller once it is deleted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK on accessor. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/web_intent_picker_gtk.cc
diff --git a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
index 47cec583192887985f12b2e0f972fbc83c1b28b6..fa8cd17a43602274398b3b666a7f2eab49202093 100644
--- a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
+++ b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc
@@ -287,6 +287,7 @@ void WebIntentPickerGtk::OnExtensionIconChanged(
void WebIntentPickerGtk::OnInlineDisposition(const string16& title,
const GURL& url) {
+ DCHECK(delegate_);
content::WebContents* web_contents =
delegate_->CreateWebContentsForInlineDisposition(
tab_contents_->profile(), url);
@@ -414,6 +415,10 @@ void WebIntentPickerGtk::OnPendingAsyncCompleted() {
gtk_widget_show_all(contents_);
}
+void WebIntentPickerGtk::InvalidateDelegate() {
+ delegate_ = NULL;
+}
+
GtkWidget* WebIntentPickerGtk::GetWidgetRoot() {
return contents_;
}
@@ -425,7 +430,8 @@ GtkWidget* WebIntentPickerGtk::GetFocusWidget() {
void WebIntentPickerGtk::DeleteDelegate() {
// The delegate is deleted when the contents widget is destroyed. See
// OnDestroy.
- delegate_->OnClosing();
+ if (delegate_)
+ delegate_->OnClosing();
}
bool WebIntentPickerGtk::ShouldHaveBorderPadding() const {
@@ -456,10 +462,12 @@ void WebIntentPickerGtk::OnDestroy(GtkWidget* button) {
}
void WebIntentPickerGtk::OnCloseButtonClick(GtkWidget* button) {
+ DCHECK(delegate_);
delegate_->OnUserCancelledPickerDialog();
}
void WebIntentPickerGtk::OnExtensionLinkClick(GtkWidget* link) {
+ DCHECK(delegate_);
size_t index = GetExtensionWidgetRow(link);
const WebIntentPickerModel::SuggestedExtension& extension =
model_->GetSuggestedExtensionAt(index);
@@ -468,6 +476,7 @@ void WebIntentPickerGtk::OnExtensionLinkClick(GtkWidget* link) {
}
void WebIntentPickerGtk::OnExtensionInstallButtonClick(GtkWidget* button) {
+ DCHECK(delegate_);
size_t index = GetExtensionWidgetRow(button);
const WebIntentPickerModel::SuggestedExtension& extension =
model_->GetSuggestedExtensionAt(index);
@@ -498,18 +507,19 @@ void WebIntentPickerGtk::OnExtensionInstallButtonClick(GtkWidget* button) {
}
void WebIntentPickerGtk::OnMoreSuggestionsLinkClick(GtkWidget* link) {
- // TODO(binji): This should link to a CWS search, based on the current
- // action/type pair.
+ DCHECK(delegate_);
delegate_->OnSuggestionsLinkClicked(
event_utils::DispositionForCurrentButtonPressEvent());
}
void WebIntentPickerGtk::OnChooseAnotherServiceClick(GtkWidget* link) {
+ DCHECK(delegate_);
delegate_->OnChooseAnotherService();
ResetContents();
}
void WebIntentPickerGtk::OnServiceButtonClick(GtkWidget* button) {
+ DCHECK(delegate_);
GList* button_list = gtk_container_get_children(GTK_CONTAINER(button_vbox_));
gint index = g_list_index(button_list, button);
DCHECK(index != -1);

Powered by Google App Engine
This is Rietveld 408576698