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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 12593012: Instant: Possible fix for crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 "last_match_was_search_=%d instant_tab_=%d", type, 624 "last_match_was_search_=%d instant_tab_=%d", type,
625 UTF16ToUTF8(last_omnibox_text_).c_str(), last_match_was_search_, 625 UTF16ToUTF8(last_omnibox_text_).c_str(), last_match_was_search_,
626 instant_tab_ != NULL)); 626 instant_tab_ != NULL));
627 627
628 // If we are on an already committed search results page, send a submit event 628 // If we are on an already committed search results page, send a submit event
629 // to the page, but otherwise, nothing else to do. 629 // to the page, but otherwise, nothing else to do.
630 if (instant_tab_) { 630 if (instant_tab_) {
631 if (type == INSTANT_COMMIT_PRESSED_ENTER && 631 if (type == INSTANT_COMMIT_PRESSED_ENTER &&
632 (last_match_was_search_ || 632 (last_match_was_search_ ||
633 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER)) { 633 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER)) {
634 EnsureSearchTermsAreSet(instant_tab_->contents(), last_omnibox_text_); 634 last_suggestion_.text.clear();
Jered 2013/03/17 17:43:38 Why do this?
sreeram 2013/03/17 17:53:27 Line 636 calls Focus() on the web contents. I assu
635 instant_tab_->Submit(last_omnibox_text_); 635 instant_tab_->Submit(last_omnibox_text_);
636 instant_tab_->contents()->GetView()->Focus(); 636 instant_tab_->contents()->GetView()->Focus();
637 EnsureSearchTermsAreSet(instant_tab_->contents(), last_omnibox_text_);
637 return true; 638 return true;
638 } 639 }
639 return false; 640 return false;
640 } 641 }
641 642
642 // If the overlay is not showing at all, don't commit it. 643 // If the overlay is not showing at all, don't commit it.
643 if (!model_.mode().is_search_suggestions()) 644 if (!model_.mode().is_search_suggestions())
644 return false; 645 return false;
645 646
646 // If the overlay is showing at full height (with results), commit it. 647 // If the overlay is showing at full height (with results), commit it.
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 // for instance, if the user types 'i' and the suggestion is 'INSTANT', 1573 // for instance, if the user types 'i' and the suggestion is 'INSTANT',
1573 // suggest 'nstant'. Otherwise, the user text really isn't a prefix, so 1574 // suggest 'nstant'. Otherwise, the user text really isn't a prefix, so
1574 // suggest nothing. 1575 // suggest nothing.
1575 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572. 1576 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572.
1576 return true; 1577 return true;
1577 } 1578 }
1578 } 1579 }
1579 1580
1580 return false; 1581 return false;
1581 } 1582 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698