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

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

Issue 1072163003: Make GetInfoForCurrentText() return the correct match when we've selected an (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 5 years, 8 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
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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 if (result().empty()) 1368 if (result().empty())
1369 return; 1369 return;
1370 // The user cannot have manually selected a match, or the query would have 1370 // The user cannot have manually selected a match, or the query would have
1371 // stopped. So the default match must be the desired selection. 1371 // stopped. So the default match must be the desired selection.
1372 *match = *result().default_match(); 1372 *match = *result().default_match();
1373 } else { 1373 } else {
1374 // If there are no results, the popup should be closed, so we shouldn't 1374 // If there are no results, the popup should be closed, so we shouldn't
1375 // have gotten here. 1375 // have gotten here.
1376 CHECK(!result().empty()); 1376 CHECK(!result().empty());
1377 CHECK(popup_model()->selected_line() < result().size()); 1377 CHECK(popup_model()->selected_line() < result().size());
1378 *match = result().match_at(popup_model()->selected_line()); 1378 const AutocompleteMatch& selected_match =
1379 result().match_at(popup_model()->selected_line());
1380 *match =
1381 (popup_model()->selected_line_state() == OmniboxPopupModel::KEYWORD) ?
1382 *selected_match.associated_keyword : selected_match;
1379 } 1383 }
1380 if (alternate_nav_url && 1384 if (alternate_nav_url &&
1381 (!popup_model() || popup_model()->manually_selected_match().empty())) 1385 (!popup_model() || popup_model()->manually_selected_match().empty()))
1382 *alternate_nav_url = result().alternate_nav_url(); 1386 *alternate_nav_url = result().alternate_nav_url();
1383 } else { 1387 } else {
1384 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( 1388 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
1385 UserTextFromDisplayText(view_->GetText()), is_keyword_selected(), true, 1389 UserTextFromDisplayText(view_->GetText()), is_keyword_selected(), true,
1386 ClassifyPage(), match, alternate_nav_url); 1390 ClassifyPage(), match, alternate_nav_url);
1387 } 1391 }
1388 } 1392 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 // Update state and notify view if the omnibox has focus and the caret 1498 // Update state and notify view if the omnibox has focus and the caret
1495 // visibility changed. 1499 // visibility changed.
1496 const bool was_caret_visible = is_caret_visible(); 1500 const bool was_caret_visible = is_caret_visible();
1497 focus_state_ = state; 1501 focus_state_ = state;
1498 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1502 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1499 is_caret_visible() != was_caret_visible) 1503 is_caret_visible() != was_caret_visible)
1500 view_->ApplyCaretVisibility(); 1504 view_->ApplyCaretVisibility();
1501 1505
1502 delegate_->OnFocusChanged(focus_state_, reason); 1506 delegate_->OnFocusChanged(focus_state_, reason);
1503 } 1507 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/omnibox/omnibox_popup_model.h » ('j') | chrome/browser/ui/omnibox/omnibox_popup_model.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698