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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 string16::const_iterator end(old_text.begin() + shorter_length); | 109 string16::const_iterator end(old_text.begin() + shorter_length); |
110 string16::const_iterator mismatch( | 110 string16::const_iterator mismatch( |
111 std::mismatch(old_text.begin(), end, new_text.begin()).first); | 111 std::mismatch(old_text.begin(), end, new_text.begin()).first); |
112 size_t matching_characters = mismatch - old_text.begin(); | 112 size_t matching_characters = mismatch - old_text.begin(); |
113 percent = static_cast<float>(matching_characters) / avg_length * 100; | 113 percent = static_cast<float>(matching_characters) / avg_length * 100; |
114 } | 114 } |
115 | 115 |
116 if (search_term_replacement_active) { | 116 if (search_term_replacement_active) { |
117 if (transition == content::PAGE_TRANSITION_TYPED) { | 117 if (transition == content::PAGE_TRANSITION_TYPED) { |
118 UMA_HISTOGRAM_PERCENTAGE( | 118 UMA_HISTOGRAM_PERCENTAGE( |
119 "InstantExtended.PercentageMatchQuerytoURL", percent); | 119 "InstantExtended.PercentageMatchV2_QuerytoURL", percent); |
120 } else { | 120 } else { |
121 UMA_HISTOGRAM_PERCENTAGE( | 121 UMA_HISTOGRAM_PERCENTAGE( |
122 "InstantExtended.PercentageMatchQuerytoQuery", percent); | 122 "InstantExtended.PercentageMatchV2_QuerytoQuery", percent); |
123 } | 123 } |
124 } else { | 124 } else { |
125 if (transition == content::PAGE_TRANSITION_TYPED) { | 125 if (transition == content::PAGE_TRANSITION_TYPED) { |
126 UMA_HISTOGRAM_PERCENTAGE( | 126 UMA_HISTOGRAM_PERCENTAGE( |
127 "InstantExtended.PercentageMatchURLtoURL", percent); | 127 "InstantExtended.PercentageMatchV2_URLtoURL", percent); |
128 } else { | 128 } else { |
129 UMA_HISTOGRAM_PERCENTAGE( | 129 UMA_HISTOGRAM_PERCENTAGE( |
130 "InstantExtended.PercentageMatchURLtoQuery", percent); | 130 "InstantExtended.PercentageMatchV2_URLtoQuery", percent); |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 } // namespace | 135 } // namespace |
136 | 136 |
137 /////////////////////////////////////////////////////////////////////////////// | 137 /////////////////////////////////////////////////////////////////////////////// |
138 // OmniboxEditModel::State | 138 // OmniboxEditModel::State |
139 | 139 |
140 OmniboxEditModel::State::State(bool user_input_in_progress, | 140 OmniboxEditModel::State::State(bool user_input_in_progress, |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 instant->OmniboxFocusChanged(state, reason, NULL); | 1300 instant->OmniboxFocusChanged(state, reason, NULL); |
1301 | 1301 |
1302 // Update state and notify view if the omnibox has focus and the caret | 1302 // Update state and notify view if the omnibox has focus and the caret |
1303 // visibility changed. | 1303 // visibility changed. |
1304 const bool was_caret_visible = is_caret_visible(); | 1304 const bool was_caret_visible = is_caret_visible(); |
1305 focus_state_ = state; | 1305 focus_state_ = state; |
1306 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1306 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1307 is_caret_visible() != was_caret_visible) | 1307 is_caret_visible() != was_caret_visible) |
1308 view_->ApplyCaretVisibility(); | 1308 view_->ApplyCaretVisibility(); |
1309 } | 1309 } |
OLD | NEW |