| 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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 return (focus_source_ == FAKEBOX) ? | 1426 return (focus_source_ == FAKEBOX) ? |
| 1427 AutocompleteInput::INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS : | 1427 AutocompleteInput::INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS : |
| 1428 AutocompleteInput::INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS; | 1428 AutocompleteInput::INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS; |
| 1429 } | 1429 } |
| 1430 const GURL& gurl = delegate_->GetURL(); | 1430 const GURL& gurl = delegate_->GetURL(); |
| 1431 if (!gurl.is_valid()) | 1431 if (!gurl.is_valid()) |
| 1432 return AutocompleteInput::INVALID_SPEC; | 1432 return AutocompleteInput::INVALID_SPEC; |
| 1433 const std::string& url = gurl.spec(); | 1433 const std::string& url = gurl.spec(); |
| 1434 if (url == chrome::kChromeUINewTabURL) | 1434 if (url == chrome::kChromeUINewTabURL) |
| 1435 return AutocompleteInput::NTP; | 1435 return AutocompleteInput::NTP; |
| 1436 if (url == content::kAboutBlankURL) | 1436 if (url == url::kAboutBlankURL) |
| 1437 return AutocompleteInput::BLANK; | 1437 return AutocompleteInput::BLANK; |
| 1438 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) | 1438 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) |
| 1439 return AutocompleteInput::HOME_PAGE; | 1439 return AutocompleteInput::HOME_PAGE; |
| 1440 if (controller_->GetToolbarModel()->WouldPerformSearchTermReplacement(true)) | 1440 if (controller_->GetToolbarModel()->WouldPerformSearchTermReplacement(true)) |
| 1441 return AutocompleteInput::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT; | 1441 return AutocompleteInput::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT; |
| 1442 if (delegate_->IsSearchResultsPage()) | 1442 if (delegate_->IsSearchResultsPage()) |
| 1443 return AutocompleteInput::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT; | 1443 return AutocompleteInput::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT; |
| 1444 return AutocompleteInput::OTHER; | 1444 return AutocompleteInput::OTHER; |
| 1445 } | 1445 } |
| 1446 | 1446 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1461 // Update state and notify view if the omnibox has focus and the caret | 1461 // Update state and notify view if the omnibox has focus and the caret |
| 1462 // visibility changed. | 1462 // visibility changed. |
| 1463 const bool was_caret_visible = is_caret_visible(); | 1463 const bool was_caret_visible = is_caret_visible(); |
| 1464 focus_state_ = state; | 1464 focus_state_ = state; |
| 1465 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1465 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1466 is_caret_visible() != was_caret_visible) | 1466 is_caret_visible() != was_caret_visible) |
| 1467 view_->ApplyCaretVisibility(); | 1467 view_->ApplyCaretVisibility(); |
| 1468 | 1468 |
| 1469 delegate_->OnFocusChanged(focus_state_, reason); | 1469 delegate_->OnFocusChanged(focus_state_, reason); |
| 1470 } | 1470 } |
| OLD | NEW |