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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "components/omnibox/browser/autocomplete_match_type.h" | 45 #include "components/omnibox/browser/autocomplete_match_type.h" |
46 #include "components/omnibox/browser/autocomplete_provider.h" | 46 #include "components/omnibox/browser/autocomplete_provider.h" |
47 #include "components/omnibox/browser/history_url_provider.h" | 47 #include "components/omnibox/browser/history_url_provider.h" |
48 #include "components/omnibox/browser/keyword_provider.h" | 48 #include "components/omnibox/browser/keyword_provider.h" |
49 #include "components/omnibox/browser/omnibox_log.h" | 49 #include "components/omnibox/browser/omnibox_log.h" |
50 #include "components/omnibox/browser/omnibox_popup_view.h" | 50 #include "components/omnibox/browser/omnibox_popup_view.h" |
51 #include "components/omnibox/browser/search_provider.h" | 51 #include "components/omnibox/browser/search_provider.h" |
52 #include "components/search_engines/template_url.h" | 52 #include "components/search_engines/template_url.h" |
53 #include "components/search_engines/template_url_prepopulate_data.h" | 53 #include "components/search_engines/template_url_prepopulate_data.h" |
54 #include "components/search_engines/template_url_service.h" | 54 #include "components/search_engines/template_url_service.h" |
55 #include "components/url_fixer/url_fixer.h" | 55 #include "components/url_formatter/url_fixer.h" |
56 #include "content/public/browser/navigation_controller.h" | 56 #include "content/public/browser/navigation_controller.h" |
57 #include "content/public/browser/navigation_entry.h" | 57 #include "content/public/browser/navigation_entry.h" |
58 #include "content/public/browser/user_metrics.h" | 58 #include "content/public/browser/user_metrics.h" |
59 #include "ui/gfx/image/image.h" | 59 #include "ui/gfx/image/image.h" |
60 #include "url/url_util.h" | 60 #include "url/url_util.h" |
61 | 61 |
62 using bookmarks::BookmarkModel; | 62 using bookmarks::BookmarkModel; |
63 using metrics::OmniboxEventProto; | 63 using metrics::OmniboxEventProto; |
64 using predictors::AutocompleteActionPredictor; | 64 using predictors::AutocompleteActionPredictor; |
65 | 65 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 !(popup_model() && popup_model()->IsOpen()) && | 314 !(popup_model() && popup_model()->IsOpen()) && |
315 controller_->GetToolbarModel()->url_replacement_enabled())) && | 315 controller_->GetToolbarModel()->url_replacement_enabled())) && |
316 (gray_text.empty() || | 316 (gray_text.empty() || |
317 new_permanent_text != user_text_ + gray_text); | 317 new_permanent_text != user_text_ + gray_text); |
318 | 318 |
319 permanent_text_ = new_permanent_text; | 319 permanent_text_ = new_permanent_text; |
320 return visibly_changed_permanent_text; | 320 return visibly_changed_permanent_text; |
321 } | 321 } |
322 | 322 |
323 GURL OmniboxEditModel::PermanentURL() { | 323 GURL OmniboxEditModel::PermanentURL() { |
324 return url_fixer::FixupURL(base::UTF16ToUTF8(permanent_text_), std::string()); | 324 return url_formatter::FixupURL(base::UTF16ToUTF8(permanent_text_), |
| 325 std::string()); |
325 } | 326 } |
326 | 327 |
327 void OmniboxEditModel::SetUserText(const base::string16& text) { | 328 void OmniboxEditModel::SetUserText(const base::string16& text) { |
328 SetInputInProgress(true); | 329 SetInputInProgress(true); |
329 InternalSetUserText(text); | 330 InternalSetUserText(text); |
330 omnibox_controller_->InvalidateCurrentMatch(); | 331 omnibox_controller_->InvalidateCurrentMatch(); |
331 paste_state_ = NONE; | 332 paste_state_ = NONE; |
332 has_temporary_text_ = false; | 333 has_temporary_text_ = false; |
333 } | 334 } |
334 | 335 |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 // Update state and notify view if the omnibox has focus and the caret | 1554 // Update state and notify view if the omnibox has focus and the caret |
1554 // visibility changed. | 1555 // visibility changed. |
1555 const bool was_caret_visible = is_caret_visible(); | 1556 const bool was_caret_visible = is_caret_visible(); |
1556 focus_state_ = state; | 1557 focus_state_ = state; |
1557 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1558 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1558 is_caret_visible() != was_caret_visible) | 1559 is_caret_visible() != was_caret_visible) |
1559 view_->ApplyCaretVisibility(); | 1560 view_->ApplyCaretVisibility(); |
1560 | 1561 |
1561 client_->OnFocusChanged(focus_state_, reason); | 1562 client_->OnFocusChanged(focus_state_, reason); |
1562 } | 1563 } |
OLD | NEW |