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