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 "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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 KeywordIsSelected(), true, &match, NULL); | 428 KeywordIsSelected(), true, &match, NULL); |
429 if (AutocompleteMatch::IsSearchType(match.type)) | 429 if (AutocompleteMatch::IsSearchType(match.type)) |
430 return; | 430 return; |
431 *url = match.destination_url; | 431 *url = match.destination_url; |
432 | 432 |
433 // Prefix the text with 'http://' if the text doesn't start with 'http://', | 433 // Prefix the text with 'http://' if the text doesn't start with 'http://', |
434 // the text parses as a url with a scheme of http, the user selected the | 434 // the text parses as a url with a scheme of http, the user selected the |
435 // entire host, and the user hasn't edited the host or manually removed the | 435 // entire host, and the user hasn't edited the host or manually removed the |
436 // scheme. | 436 // scheme. |
437 GURL perm_url(PermanentURL()); | 437 GURL perm_url(PermanentURL()); |
438 if (perm_url.SchemeIs(chrome::kHttpScheme) && | 438 if (perm_url.SchemeIs(content::kHttpScheme) && |
439 url->SchemeIs(chrome::kHttpScheme) && perm_url.host() == url->host()) { | 439 url->SchemeIs(content::kHttpScheme) && perm_url.host() == url->host()) { |
440 *write_url = true; | 440 *write_url = true; |
441 string16 http = ASCIIToUTF16(chrome::kHttpScheme) + | 441 string16 http = ASCIIToUTF16(content::kHttpScheme) + |
442 ASCIIToUTF16(content::kStandardSchemeSeparator); | 442 ASCIIToUTF16(content::kStandardSchemeSeparator); |
443 if (text->compare(0, http.length(), http) != 0) | 443 if (text->compare(0, http.length(), http) != 0) |
444 *text = http + *text; | 444 *text = http + *text; |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
448 void OmniboxEditModel::SetInputInProgress(bool in_progress) { | 448 void OmniboxEditModel::SetInputInProgress(bool in_progress) { |
449 if (in_progress && !user_input_since_focus_) { | 449 if (in_progress && !user_input_since_focus_) { |
450 base::TimeTicks now = base::TimeTicks::Now(); | 450 base::TimeTicks now = base::TimeTicks::Now(); |
451 DCHECK(last_omnibox_focus_ <= now); | 451 DCHECK(last_omnibox_focus_ <= now); |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 instant->OmniboxFocusChanged(state, reason, NULL); | 1363 instant->OmniboxFocusChanged(state, reason, NULL); |
1364 | 1364 |
1365 // Update state and notify view if the omnibox has focus and the caret | 1365 // Update state and notify view if the omnibox has focus and the caret |
1366 // visibility changed. | 1366 // visibility changed. |
1367 const bool was_caret_visible = is_caret_visible(); | 1367 const bool was_caret_visible = is_caret_visible(); |
1368 focus_state_ = state; | 1368 focus_state_ = state; |
1369 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1369 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1370 is_caret_visible() != was_caret_visible) | 1370 is_caret_visible() != was_caret_visible) |
1371 view_->ApplyCaretVisibility(); | 1371 view_->ApplyCaretVisibility(); |
1372 } | 1372 } |
OLD | NEW |