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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 *text, KeywordIsSelected(), true, ClassifyPage(), &match, NULL); | 474 *text, KeywordIsSelected(), true, ClassifyPage(), &match, NULL); |
475 if (AutocompleteMatch::IsSearchType(match.type)) | 475 if (AutocompleteMatch::IsSearchType(match.type)) |
476 return; | 476 return; |
477 *url = match.destination_url; | 477 *url = match.destination_url; |
478 | 478 |
479 // Prefix the text with 'http://' if the text doesn't start with 'http://', | 479 // Prefix the text with 'http://' if the text doesn't start with 'http://', |
480 // the text parses as a url with a scheme of http, the user selected the | 480 // the text parses as a url with a scheme of http, the user selected the |
481 // entire host, and the user hasn't edited the host or manually removed the | 481 // entire host, and the user hasn't edited the host or manually removed the |
482 // scheme. | 482 // scheme. |
483 GURL perm_url(PermanentURL()); | 483 GURL perm_url(PermanentURL()); |
484 if (perm_url.SchemeIs(content::kHttpScheme) && | 484 if (perm_url.SchemeIs(url::kHttpScheme) && |
485 url->SchemeIs(content::kHttpScheme) && perm_url.host() == url->host()) { | 485 url->SchemeIs(url::kHttpScheme) && perm_url.host() == url->host()) { |
486 *write_url = true; | 486 *write_url = true; |
487 base::string16 http = base::ASCIIToUTF16(content::kHttpScheme) + | 487 base::string16 http = base::ASCIIToUTF16(url::kHttpScheme) + |
488 base::ASCIIToUTF16(content::kStandardSchemeSeparator); | 488 base::ASCIIToUTF16(content::kStandardSchemeSeparator); |
489 if (text->compare(0, http.length(), http) != 0) | 489 if (text->compare(0, http.length(), http) != 0) |
490 *text = http + *text; | 490 *text = http + *text; |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
494 void OmniboxEditModel::SetInputInProgress(bool in_progress) { | 494 void OmniboxEditModel::SetInputInProgress(bool in_progress) { |
495 if (in_progress && !user_input_since_focus_) { | 495 if (in_progress && !user_input_since_focus_) { |
496 base::TimeTicks now = base::TimeTicks::Now(); | 496 base::TimeTicks now = base::TimeTicks::Now(); |
497 DCHECK(last_omnibox_focus_ <= now); | 497 DCHECK(last_omnibox_focus_ <= now); |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 // Update state and notify view if the omnibox has focus and the caret | 1455 // Update state and notify view if the omnibox has focus and the caret |
1456 // visibility changed. | 1456 // visibility changed. |
1457 const bool was_caret_visible = is_caret_visible(); | 1457 const bool was_caret_visible = is_caret_visible(); |
1458 focus_state_ = state; | 1458 focus_state_ = state; |
1459 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1459 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1460 is_caret_visible() != was_caret_visible) | 1460 is_caret_visible() != was_caret_visible) |
1461 view_->ApplyCaretVisibility(); | 1461 view_->ApplyCaretVisibility(); |
1462 | 1462 |
1463 delegate_->OnFocusChanged(focus_state_, reason); | 1463 delegate_->OnFocusChanged(focus_state_, reason); |
1464 } | 1464 } |
OLD | NEW |