Index: chrome/browser/android/contextualsearch/contextual_search_delegate.cc |
diff --git a/chrome/browser/android/contextualsearch/contextual_search_delegate.cc b/chrome/browser/android/contextualsearch/contextual_search_delegate.cc |
index e2dfe1c036ef21aaddf0605255522b500c07518a..c00aa10772e1c58d35188ba6fb0dcfe3016d441a 100644 |
--- a/chrome/browser/android/contextualsearch/contextual_search_delegate.cc |
+++ b/chrome/browser/android/contextualsearch/contextual_search_delegate.cc |
@@ -248,21 +248,19 @@ void ContextualSearchDelegate::GatherSurroundingTextWithCallback( |
content::WebContents* web_contents, |
bool may_send_base_page_url, |
HandleSurroundingsCallback callback) { |
- DCHECK(web_contents); |
- DCHECK(!callback.is_null()); |
- DCHECK(!selection.empty()); |
- RenderFrameHost* focused_frame = web_contents->GetFocusedFrame(); |
- if (!focused_frame) { |
- callback.Run(base::string16(), 0, 0); |
- return; |
- } |
// Immediately cancel any request that's in flight, since we're building a new |
// context (and the response disposes of any existing context). |
search_term_fetcher_.reset(); |
BuildContext(selection, use_resolved_search_term, web_contents, |
may_send_base_page_url); |
- focused_frame->RequestTextSurroundingSelection( |
- callback, field_trial_->GetSurroundingSize()); |
+ DCHECK(web_contents); |
+ RenderFrameHost* focused_frame = web_contents->GetFocusedFrame(); |
+ if (focused_frame) { |
+ focused_frame->RequestTextSurroundingSelection( |
+ callback, field_trial_->GetSurroundingSize()); |
+ } else { |
+ callback.Run(base::string16(), 0, 0); |
+ } |
} |
void ContextualSearchDelegate::BuildContext( |