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 27 matching lines...) Expand all Loading... |
38 #include "components/omnibox/browser/keyword_provider.h" | 38 #include "components/omnibox/browser/keyword_provider.h" |
39 #include "components/omnibox/browser/omnibox_client.h" | 39 #include "components/omnibox/browser/omnibox_client.h" |
40 #include "components/omnibox/browser/omnibox_edit_controller.h" | 40 #include "components/omnibox/browser/omnibox_edit_controller.h" |
41 #include "components/omnibox/browser/omnibox_log.h" | 41 #include "components/omnibox/browser/omnibox_log.h" |
42 #include "components/omnibox/browser/omnibox_popup_view.h" | 42 #include "components/omnibox/browser/omnibox_popup_view.h" |
43 #include "components/omnibox/browser/search_provider.h" | 43 #include "components/omnibox/browser/search_provider.h" |
44 #include "components/search_engines/template_url.h" | 44 #include "components/search_engines/template_url.h" |
45 #include "components/search_engines/template_url_prepopulate_data.h" | 45 #include "components/search_engines/template_url_prepopulate_data.h" |
46 #include "components/search_engines/template_url_service.h" | 46 #include "components/search_engines/template_url_service.h" |
47 #include "components/toolbar/toolbar_model.h" | 47 #include "components/toolbar/toolbar_model.h" |
48 #include "components/url_formatter/url_fixer.h" | 48 #include "components/url_fixer/url_fixer.h" |
49 #include "ui/gfx/image/image.h" | 49 #include "ui/gfx/image/image.h" |
50 #include "url/url_util.h" | 50 #include "url/url_util.h" |
51 | 51 |
52 using bookmarks::BookmarkModel; | 52 using bookmarks::BookmarkModel; |
53 using metrics::OmniboxEventProto; | 53 using metrics::OmniboxEventProto; |
54 | 54 |
55 | 55 |
56 // Helpers -------------------------------------------------------------------- | 56 // Helpers -------------------------------------------------------------------- |
57 | 57 |
58 namespace { | 58 namespace { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 !(popup_model() && popup_model()->IsOpen()) && | 303 !(popup_model() && popup_model()->IsOpen()) && |
304 controller_->GetToolbarModel()->url_replacement_enabled())) && | 304 controller_->GetToolbarModel()->url_replacement_enabled())) && |
305 (gray_text.empty() || | 305 (gray_text.empty() || |
306 new_permanent_text != user_text_ + gray_text); | 306 new_permanent_text != user_text_ + gray_text); |
307 | 307 |
308 permanent_text_ = new_permanent_text; | 308 permanent_text_ = new_permanent_text; |
309 return visibly_changed_permanent_text; | 309 return visibly_changed_permanent_text; |
310 } | 310 } |
311 | 311 |
312 GURL OmniboxEditModel::PermanentURL() { | 312 GURL OmniboxEditModel::PermanentURL() { |
313 return url_formatter::FixupURL(base::UTF16ToUTF8(permanent_text_), | 313 return url_fixer::FixupURL(base::UTF16ToUTF8(permanent_text_), std::string()); |
314 std::string()); | |
315 } | 314 } |
316 | 315 |
317 void OmniboxEditModel::SetUserText(const base::string16& text) { | 316 void OmniboxEditModel::SetUserText(const base::string16& text) { |
318 SetInputInProgress(true); | 317 SetInputInProgress(true); |
319 InternalSetUserText(text); | 318 InternalSetUserText(text); |
320 omnibox_controller_->InvalidateCurrentMatch(); | 319 omnibox_controller_->InvalidateCurrentMatch(); |
321 paste_state_ = NONE; | 320 paste_state_ = NONE; |
322 has_temporary_text_ = false; | 321 has_temporary_text_ = false; |
323 } | 322 } |
324 | 323 |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 // Update state and notify view if the omnibox has focus and the caret | 1466 // Update state and notify view if the omnibox has focus and the caret |
1468 // visibility changed. | 1467 // visibility changed. |
1469 const bool was_caret_visible = is_caret_visible(); | 1468 const bool was_caret_visible = is_caret_visible(); |
1470 focus_state_ = state; | 1469 focus_state_ = state; |
1471 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1470 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1472 is_caret_visible() != was_caret_visible) | 1471 is_caret_visible() != was_caret_visible) |
1473 view_->ApplyCaretVisibility(); | 1472 view_->ApplyCaretVisibility(); |
1474 | 1473 |
1475 client_->OnFocusChanged(focus_state_, reason); | 1474 client_->OnFocusChanged(focus_state_, reason); |
1476 } | 1475 } |
OLD | NEW |