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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "components/omnibox/browser/omnibox_log.h" | 28 #include "components/omnibox/browser/omnibox_log.h" |
29 #include "components/omnibox/browser/omnibox_navigation_observer.h" | 29 #include "components/omnibox/browser/omnibox_navigation_observer.h" |
30 #include "components/omnibox/browser/omnibox_popup_model.h" | 30 #include "components/omnibox/browser/omnibox_popup_model.h" |
31 #include "components/omnibox/browser/omnibox_popup_view.h" | 31 #include "components/omnibox/browser/omnibox_popup_view.h" |
32 #include "components/omnibox/browser/omnibox_view.h" | 32 #include "components/omnibox/browser/omnibox_view.h" |
33 #include "components/omnibox/browser/search_provider.h" | 33 #include "components/omnibox/browser/search_provider.h" |
34 #include "components/search_engines/template_url.h" | 34 #include "components/search_engines/template_url.h" |
35 #include "components/search_engines/template_url_prepopulate_data.h" | 35 #include "components/search_engines/template_url_prepopulate_data.h" |
36 #include "components/search_engines/template_url_service.h" | 36 #include "components/search_engines/template_url_service.h" |
37 #include "components/toolbar/toolbar_model.h" | 37 #include "components/toolbar/toolbar_model.h" |
38 #include "components/url_fixer/url_fixer.h" | 38 #include "components/url_formatter/url_fixer.h" |
39 #include "ui/gfx/image/image.h" | 39 #include "ui/gfx/image/image.h" |
40 #include "url/url_util.h" | 40 #include "url/url_util.h" |
41 | 41 |
42 using bookmarks::BookmarkModel; | 42 using bookmarks::BookmarkModel; |
43 using metrics::OmniboxEventProto; | 43 using metrics::OmniboxEventProto; |
44 | 44 |
45 | 45 |
46 // Helpers -------------------------------------------------------------------- | 46 // Helpers -------------------------------------------------------------------- |
47 | 47 |
48 namespace { | 48 namespace { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 !(popup_model() && popup_model()->IsOpen()) && | 291 !(popup_model() && popup_model()->IsOpen()) && |
292 controller_->GetToolbarModel()->url_replacement_enabled())) && | 292 controller_->GetToolbarModel()->url_replacement_enabled())) && |
293 (gray_text.empty() || | 293 (gray_text.empty() || |
294 new_permanent_text != user_text_ + gray_text); | 294 new_permanent_text != user_text_ + gray_text); |
295 | 295 |
296 permanent_text_ = new_permanent_text; | 296 permanent_text_ = new_permanent_text; |
297 return visibly_changed_permanent_text; | 297 return visibly_changed_permanent_text; |
298 } | 298 } |
299 | 299 |
300 GURL OmniboxEditModel::PermanentURL() { | 300 GURL OmniboxEditModel::PermanentURL() { |
301 return url_fixer::FixupURL(base::UTF16ToUTF8(permanent_text_), std::string()); | 301 return url_formatter::FixupURL(base::UTF16ToUTF8(permanent_text_), |
| 302 std::string()); |
302 } | 303 } |
303 | 304 |
304 void OmniboxEditModel::SetUserText(const base::string16& text) { | 305 void OmniboxEditModel::SetUserText(const base::string16& text) { |
305 SetInputInProgress(true); | 306 SetInputInProgress(true); |
306 InternalSetUserText(text); | 307 InternalSetUserText(text); |
307 omnibox_controller_->InvalidateCurrentMatch(); | 308 omnibox_controller_->InvalidateCurrentMatch(); |
308 paste_state_ = NONE; | 309 paste_state_ = NONE; |
309 has_temporary_text_ = false; | 310 has_temporary_text_ = false; |
310 } | 311 } |
311 | 312 |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 // Update state and notify view if the omnibox has focus and the caret | 1450 // Update state and notify view if the omnibox has focus and the caret |
1450 // visibility changed. | 1451 // visibility changed. |
1451 const bool was_caret_visible = is_caret_visible(); | 1452 const bool was_caret_visible = is_caret_visible(); |
1452 focus_state_ = state; | 1453 focus_state_ = state; |
1453 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1454 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1454 is_caret_visible() != was_caret_visible) | 1455 is_caret_visible() != was_caret_visible) |
1455 view_->ApplyCaretVisibility(); | 1456 view_->ApplyCaretVisibility(); |
1456 | 1457 |
1457 client_->OnFocusChanged(focus_state_, reason); | 1458 client_->OnFocusChanged(focus_state_, reason); |
1458 } | 1459 } |
OLD | NEW |