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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 12250014: Omnibox: Possibly Fix Rare OpenMatch Crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/ui/omnibox/omnibox_edit_model.h" 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 566 }
567 567
568 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, 568 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match,
569 WindowOpenDisposition disposition, 569 WindowOpenDisposition disposition,
570 const GURL& alternate_nav_url, 570 const GURL& alternate_nav_url,
571 size_t index) { 571 size_t index) {
572 // We only care about cases where there is a selection (i.e. the popup is 572 // We only care about cases where there is a selection (i.e. the popup is
573 // open). 573 // open).
574 if (popup_->IsOpen()) { 574 if (popup_->IsOpen()) {
575 const base::TimeTicks& now(base::TimeTicks::Now()); 575 const base::TimeTicks& now(base::TimeTicks::Now());
576 const content::WebContents* web_contents = controller_->GetWebContents();
576 // TODO(sreeram): Handle is_temporary_text_set_by_instant_ correctly. 577 // TODO(sreeram): Handle is_temporary_text_set_by_instant_ correctly.
577 AutocompleteLog log( 578 AutocompleteLog log(
578 autocomplete_controller_->input().text(), 579 autocomplete_controller_->input().text(),
579 just_deleted_text_, 580 just_deleted_text_,
580 autocomplete_controller_->input().type(), 581 autocomplete_controller_->input().type(),
581 popup_->selected_line(), 582 popup_->selected_line(),
582 -1, // don't yet know tab ID; set later if appropriate 583 -1, // don't yet know tab ID; set later if appropriate
583 ClassifyPage(controller_->GetWebContents()->GetURL()), 584 web_contents ? ClassifyPage(web_contents->GetURL()) :
585 metrics::OmniboxEventProto_PageClassification_OTHER,
584 now - time_user_first_modified_omnibox_, 586 now - time_user_first_modified_omnibox_,
585 string16::npos, // completed_length; possibly set later 587 string16::npos, // completed_length; possibly set later
586 now - autocomplete_controller_->last_time_default_match_changed(), 588 now - autocomplete_controller_->last_time_default_match_changed(),
587 result()); 589 result());
588 DCHECK(user_input_in_progress_ || 590 DCHECK(user_input_in_progress_ ||
589 match.provider->type() == AutocompleteProvider::TYPE_ZERO_SUGGEST) 591 match.provider->type() == AutocompleteProvider::TYPE_ZERO_SUGGEST)
590 << "We didn't get here through the expected series of calls. " 592 << "We didn't get here through the expected series of calls. "
591 << "time_user_first_modified_omnibox_ is not set correctly and other " 593 << "time_user_first_modified_omnibox_ is not set correctly and other "
592 << "things may be wrong. Match provider: " << match.provider->GetName(); 594 << "things may be wrong. Match provider: " << match.provider->GetName();
593 DCHECK(log.elapsed_time_since_user_first_modified_omnibox >= 595 DCHECK(log.elapsed_time_since_user_first_modified_omnibox >=
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 instant->OmniboxFocusChanged(state, reason, NULL); 1343 instant->OmniboxFocusChanged(state, reason, NULL);
1342 1344
1343 // Update state and notify view if the omnibox has focus and the caret 1345 // Update state and notify view if the omnibox has focus and the caret
1344 // visibility changed. 1346 // visibility changed.
1345 const bool was_caret_visible = is_caret_visible(); 1347 const bool was_caret_visible = is_caret_visible();
1346 focus_state_ = state; 1348 focus_state_ = state;
1347 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1349 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1348 is_caret_visible() != was_caret_visible) 1350 is_caret_visible() != was_caret_visible)
1349 view_->ApplyCaretVisibility(); 1351 view_->ApplyCaretVisibility();
1350 } 1352 }
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