| OLD | NEW |
| 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 "components/omnibox/browser/omnibox_edit_model.h" | 5 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 *text, is_keyword_selected(), true, ClassifyPage(), &match, nullptr); | 351 *text, is_keyword_selected(), true, ClassifyPage(), &match, nullptr); |
| 352 if (AutocompleteMatch::IsSearchType(match.type)) | 352 if (AutocompleteMatch::IsSearchType(match.type)) |
| 353 return; | 353 return; |
| 354 *url = match.destination_url; | 354 *url = match.destination_url; |
| 355 | 355 |
| 356 // Prefix the text with 'http://' if the text doesn't start with 'http://', | 356 // Prefix the text with 'http://' if the text doesn't start with 'http://', |
| 357 // the text parses as a url with a scheme of http, the user selected the | 357 // the text parses as a url with a scheme of http, the user selected the |
| 358 // entire host, and the user hasn't edited the host or manually removed the | 358 // entire host, and the user hasn't edited the host or manually removed the |
| 359 // scheme. | 359 // scheme. |
| 360 GURL perm_url(PermanentURL()); | 360 GURL perm_url(PermanentURL()); |
| 361 if (perm_url.SchemeIs(url::kHttpScheme) && | 361 if (perm_url.SchemeIs(url::kHttpScheme) && url->SchemeIs(url::kHttpScheme) && |
| 362 url->SchemeIs(url::kHttpScheme) && perm_url.host() == url->host()) { | 362 perm_url.host_piece() == url->host_piece()) { |
| 363 *write_url = true; | 363 *write_url = true; |
| 364 base::string16 http = base::ASCIIToUTF16(url::kHttpScheme) + | 364 base::string16 http = base::ASCIIToUTF16(url::kHttpScheme) + |
| 365 base::ASCIIToUTF16(url::kStandardSchemeSeparator); | 365 base::ASCIIToUTF16(url::kStandardSchemeSeparator); |
| 366 if (text->compare(0, http.length(), http) != 0) | 366 if (text->compare(0, http.length(), http) != 0) |
| 367 *text = http + *text; | 367 *text = http + *text; |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 void OmniboxEditModel::SetInputInProgress(bool in_progress) { | 371 void OmniboxEditModel::SetInputInProgress(bool in_progress) { |
| 372 if (in_progress && !user_input_since_focus_) { | 372 if (in_progress && !user_input_since_focus_) { |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 // Update state and notify view if the omnibox has focus and the caret | 1416 // Update state and notify view if the omnibox has focus and the caret |
| 1417 // visibility changed. | 1417 // visibility changed. |
| 1418 const bool was_caret_visible = is_caret_visible(); | 1418 const bool was_caret_visible = is_caret_visible(); |
| 1419 focus_state_ = state; | 1419 focus_state_ = state; |
| 1420 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1420 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1421 is_caret_visible() != was_caret_visible) | 1421 is_caret_visible() != was_caret_visible) |
| 1422 view_->ApplyCaretVisibility(); | 1422 view_->ApplyCaretVisibility(); |
| 1423 | 1423 |
| 1424 client_->OnFocusChanged(focus_state_, reason); | 1424 client_->OnFocusChanged(focus_state_, reason); |
| 1425 } | 1425 } |
| OLD | NEW |