OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/quick_launch/quick_launch_application.h" | 5 #include "mash/quick_launch/quick_launch_application.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (suggestion_rejected_) | 92 if (suggestion_rejected_) |
93 return; | 93 return; |
94 | 94 |
95 // TODO(beng): it'd be nice if we persisted some history/scoring here. | 95 // TODO(beng): it'd be nice if we persisted some history/scoring here. |
96 for (const auto& name : app_names_) { | 96 for (const auto& name : app_names_) { |
97 if (base::StartsWith(name, new_contents, | 97 if (base::StartsWith(name, new_contents, |
98 base::CompareCase::INSENSITIVE_ASCII)) { | 98 base::CompareCase::INSENSITIVE_ASCII)) { |
99 base::string16 suffix = name; | 99 base::string16 suffix = name; |
100 base::ReplaceSubstringsAfterOffset(&suffix, 0, new_contents, | 100 base::ReplaceSubstringsAfterOffset(&suffix, 0, new_contents, |
101 base::string16()); | 101 base::string16()); |
102 gfx::Range range(new_contents.size(), name.size()); | 102 gfx::Range range(static_cast<uint32_t>(new_contents.size()), |
| 103 static_cast<uint32_t>(name.size())); |
103 prompt_->SetText(name); | 104 prompt_->SetText(name); |
104 prompt_->SelectRange(range); | 105 prompt_->SelectRange(range); |
105 break; | 106 break; |
106 } | 107 } |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
110 std::string Canonicalize(const base::string16& input) const { | 111 std::string Canonicalize(const base::string16& input) const { |
111 base::string16 working; | 112 base::string16 working; |
112 base::TrimWhitespace(input, base::TRIM_ALL, &working); | 113 base::TrimWhitespace(input, base::TRIM_ALL, &working); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 gfx::Rect(10, 640, 0, 0)); | 158 gfx::Rect(10, 640, 0, 0)); |
158 window->Show(); | 159 window->Show(); |
159 } | 160 } |
160 | 161 |
161 bool QuickLaunchApplication::AcceptConnection(shell::Connection* connection) { | 162 bool QuickLaunchApplication::AcceptConnection(shell::Connection* connection) { |
162 return true; | 163 return true; |
163 } | 164 } |
164 | 165 |
165 } // namespace quick_launch | 166 } // namespace quick_launch |
166 } // namespace mash | 167 } // namespace mash |
OLD | NEW |