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

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

Issue 23621037: Send URLs on non-zero prefix suggest requests also. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move set_current_page_url Created 7 years, 3 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 <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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 string16 gray_text = view_->GetGrayTextAutocompletion(); 279 string16 gray_text = view_->GetGrayTextAutocompletion();
280 const bool visibly_changed_permanent_text = 280 const bool visibly_changed_permanent_text =
281 (permanent_text_ != new_permanent_text) && 281 (permanent_text_ != new_permanent_text) &&
282 (!has_focus() || 282 (!has_focus() ||
283 (!user_input_in_progress_ && !popup_model()->IsOpen() && 283 (!user_input_in_progress_ && !popup_model()->IsOpen() &&
284 controller_->GetToolbarModel()->search_term_replacement_enabled())) && 284 controller_->GetToolbarModel()->search_term_replacement_enabled())) &&
285 (gray_text.empty() || 285 (gray_text.empty() ||
286 new_permanent_text != user_text_ + gray_text); 286 new_permanent_text != user_text_ + gray_text);
287 287
288 permanent_text_ = new_permanent_text; 288 permanent_text_ = new_permanent_text;
289
290 SearchProvider* search_provider =
291 autocomplete_controller()->search_provider();
292 if (search_provider)
293 search_provider->set_current_page_url(delegate_->GetURL());
Peter Kasting 2013/10/08 01:10:25 Nit: Put this entire block at the very top of the
H Fung 2013/10/30 23:56:15 Done.
294
289 return visibly_changed_permanent_text; 295 return visibly_changed_permanent_text;
290 } 296 }
291 297
292 GURL OmniboxEditModel::PermanentURL() { 298 GURL OmniboxEditModel::PermanentURL() {
293 return URLFixerUpper::FixupURL(UTF16ToUTF8(permanent_text_), std::string()); 299 return URLFixerUpper::FixupURL(UTF16ToUTF8(permanent_text_), std::string());
294 } 300 }
295 301
296 void OmniboxEditModel::SetUserText(const string16& text) { 302 void OmniboxEditModel::SetUserText(const string16& text) {
297 SetInputInProgress(true); 303 SetInputInProgress(true);
298 InternalSetUserText(text); 304 InternalSetUserText(text);
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 instant->OmniboxFocusChanged(state, reason, NULL); 1369 instant->OmniboxFocusChanged(state, reason, NULL);
1364 1370
1365 // Update state and notify view if the omnibox has focus and the caret 1371 // Update state and notify view if the omnibox has focus and the caret
1366 // visibility changed. 1372 // visibility changed.
1367 const bool was_caret_visible = is_caret_visible(); 1373 const bool was_caret_visible = is_caret_visible();
1368 focus_state_ = state; 1374 focus_state_ = state;
1369 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1375 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1370 is_caret_visible() != was_caret_visible) 1376 is_caret_visible() != was_caret_visible)
1371 view_->ApplyCaretVisibility(); 1377 view_->ApplyCaretVisibility();
1372 } 1378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698