Chromium Code Reviews| Index: chrome/browser/ui/views/web_intent_picker_views.cc |
| diff --git a/chrome/browser/ui/views/web_intent_picker_views.cc b/chrome/browser/ui/views/web_intent_picker_views.cc |
| index f6877492b5e6cd66a2533a61061cae84efb27d35..8dceac803f8b5be104452a3d57ffe0ca3aefcb1b 100644 |
| --- a/chrome/browser/ui/views/web_intent_picker_views.cc |
| +++ b/chrome/browser/ui/views/web_intent_picker_views.cc |
| @@ -375,7 +375,7 @@ void SuggestedExtensionsLayout::Layout(views::View* host) { |
| child_bounds.set_x(std::max(child_area.width() - size.width(), x)); |
| } else if (i == 1) { |
| // Label is considered fixed width, to align ratings widget. |
| - DCHECK_LE(size.width(), WebIntentPicker::kTitleLinkMaxWidth); |
| + // DCHECK_LE(size.width(), WebIntentPicker::kTitleLinkMaxWidth); |
|
Greg Billock
2012/10/15 22:29:33
erase this line?
groby-ooo-7-16
2012/10/16 01:13:10
Done.
|
| x += WebIntentPicker::kTitleLinkMaxWidth + |
| views::kRelatedControlHorizontalSpacing; |
| } else { |
| @@ -794,6 +794,7 @@ class WebIntentPickerViews : public views::ButtonListener, |
| virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE; |
| virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE; |
| virtual void OnPendingAsyncCompleted() OVERRIDE; |
| + virtual void InvalidateDelegate() OVERRIDE; |
| virtual void OnInlineDispositionWebContentsLoaded( |
| content::WebContents* web_contents) OVERRIDE; |
| @@ -954,11 +955,13 @@ WebIntentPickerViews::~WebIntentPickerViews() { |
| void WebIntentPickerViews::ButtonPressed(views::Button* sender, |
| const ui::Event& event) { |
| + DCHECK(delegate_); |
| delegate_->OnUserCancelledPickerDialog(); |
| } |
| void WebIntentPickerViews::WindowClosing() { |
| - delegate_->OnClosing(); |
| + if (delegate_) |
| + delegate_->OnClosing(); |
| } |
| void WebIntentPickerViews::DeleteDelegate() { |
| @@ -986,6 +989,7 @@ bool WebIntentPickerViews::Cancel() { |
| } |
| void WebIntentPickerViews::LinkClicked(views::Link* source, int event_flags) { |
| + DCHECK(delegate_); |
| if (source == more_suggestions_link_) { |
| delegate_->OnSuggestionsLinkClicked( |
| chrome::DispositionFromEventFlags(event_flags)); |
| @@ -1036,6 +1040,10 @@ void WebIntentPickerViews::OnPendingAsyncCompleted() { |
| UpdateContents(); |
| } |
| +void WebIntentPickerViews::InvalidateDelegate() { |
| + delegate_ = NULL; |
| +} |
| + |
| void WebIntentPickerViews::ShowNoServicesMessage() { |
| ClearContents(); |
| @@ -1173,11 +1181,13 @@ void WebIntentPickerViews::OnExtensionIconChanged( |
| void WebIntentPickerViews::OnInlineDisposition( |
| const string16&, const GURL& url) { |
| + DCHECK(delegate_); |
| if (!webview_) |
| webview_ = new views::WebView(tab_contents_->profile()); |
| inline_web_contents_.reset(delegate_->CreateWebContentsForInlineDisposition( |
| tab_contents_->profile(), url)); |
| + |
| // Does not take ownership, so we keep a scoped_ptr |
| // for the WebContents locally. |
| webview_->SetWebContents(inline_web_contents_.get()); |
| @@ -1202,6 +1212,7 @@ void WebIntentPickerViews::OnInlineDisposition( |
| void WebIntentPickerViews::OnExtensionInstallClicked( |
| const std::string& extension_id) { |
| + DCHECK(delegate_); |
| can_close_ = false; |
| extensions_->StartThrobber(extension_id); |
| more_suggestions_link_->SetEnabled(false); |
| @@ -1212,11 +1223,13 @@ void WebIntentPickerViews::OnExtensionInstallClicked( |
| void WebIntentPickerViews::OnExtensionLinkClicked( |
| const std::string& extension_id, |
| WindowOpenDisposition disposition) { |
| + DCHECK(delegate_); |
| delegate_->OnExtensionLinkClicked(extension_id, disposition); |
| } |
| void WebIntentPickerViews::OnActionButtonClicked( |
| IntentRowView::ActionType type, size_t tag) { |
| + DCHECK(delegate_); |
| DCHECK_EQ(IntentRowView::ACTION_INVOKE, type); |
| const WebIntentPickerModel::InstalledService& service = |
| model_->GetInstalledServiceAt(tag); |