OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/views/omnibox/omnibox_view_win.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <locale> | 8 #include <locale> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 // sure to not flag cases like selecting part of the text and then pasting | 908 // sure to not flag cases like selecting part of the text and then pasting |
909 // (or typing) the prefix of that selection. (We detect these by making | 909 // (or typing) the prefix of that selection. (We detect these by making |
910 // sure the caret, which should be after any insertion, hasn't moved | 910 // sure the caret, which should be after any insertion, hasn't moved |
911 // forward of the old selection start.) | 911 // forward of the old selection start.) |
912 const bool just_deleted_text = | 912 const bool just_deleted_text = |
913 (text_before_change_.length() > new_text.length()) && | 913 (text_before_change_.length() > new_text.length()) && |
914 (new_sel.cpMin <= std::min(sel_before_change_.cpMin, | 914 (new_sel.cpMin <= std::min(sel_before_change_.cpMin, |
915 sel_before_change_.cpMax)); | 915 sel_before_change_.cpMax)); |
916 | 916 |
917 const bool something_changed = model_->OnAfterPossibleChange( | 917 const bool something_changed = model_->OnAfterPossibleChange( |
918 new_text, new_sel.cpMin, new_sel.cpMax, selection_differs, | 918 text_before_change_, new_text, new_sel.cpMin, new_sel.cpMax, |
919 text_differs, just_deleted_text, !IsImeComposing()); | 919 selection_differs, text_differs, just_deleted_text, !IsImeComposing()); |
920 | 920 |
921 if (selection_differs) | 921 if (selection_differs) |
922 controller_->OnSelectionBoundsChanged(); | 922 controller_->OnSelectionBoundsChanged(); |
923 | 923 |
924 if (something_changed && text_differs) | 924 if (something_changed && text_differs) |
925 TextChanged(); | 925 TextChanged(); |
926 | 926 |
927 if (text_differs) { | 927 if (text_differs) { |
928 // Note that a TEXT_CHANGED event implies that the cursor/selection | 928 // Note that a TEXT_CHANGED event implies that the cursor/selection |
929 // probably changed too, so we don't need to send both. | 929 // probably changed too, so we don't need to send both. |
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 return omnibox_view; | 2725 return omnibox_view; |
2726 } | 2726 } |
2727 return new OmniboxViewWin(controller, | 2727 return new OmniboxViewWin(controller, |
2728 toolbar_model, | 2728 toolbar_model, |
2729 location_bar, | 2729 location_bar, |
2730 command_updater, | 2730 command_updater, |
2731 popup_window_mode, | 2731 popup_window_mode, |
2732 location_bar); | 2732 location_bar); |
2733 } | 2733 } |
2734 #endif | 2734 #endif |
OLD | NEW |