Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: mash/quick_launch/quick_launch.cc

Issue 2505283003: Fix Ctrl-A then Ctrl-X infinite loop in quick_launch. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "mash/quick_launch/quick_launch.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 UpdateEntries(); 89 UpdateEntries();
90 } 90 }
91 return false; 91 return false;
92 } 92 }
93 void ContentsChanged(views::Textfield* sender, 93 void ContentsChanged(views::Textfield* sender,
94 const base::string16& new_contents) override { 94 const base::string16& new_contents) override {
95 // Don't keep making a suggestion if the user didn't like what we offered. 95 // Don't keep making a suggestion if the user didn't like what we offered.
96 if (suggestion_rejected_) 96 if (suggestion_rejected_)
97 return; 97 return;
98 98
99 if (new_contents.length() == 0)
sadrul 2016/11/17 20:32:46 new_contents.empty()
Hadi 2016/11/17 20:44:31 Done.
100 return;
101
99 // TODO(beng): it'd be nice if we persisted some history/scoring here. 102 // TODO(beng): it'd be nice if we persisted some history/scoring here.
100 for (const auto& name : app_names_) { 103 for (const auto& name : app_names_) {
101 if (base::StartsWith(name, new_contents, 104 if (base::StartsWith(name, new_contents,
102 base::CompareCase::INSENSITIVE_ASCII)) { 105 base::CompareCase::INSENSITIVE_ASCII)) {
103 base::string16 suffix = name; 106 base::string16 suffix = name;
104 base::ReplaceSubstringsAfterOffset(&suffix, 0, new_contents, 107 base::ReplaceSubstringsAfterOffset(&suffix, 0, new_contents,
105 base::string16()); 108 base::string16());
106 gfx::Range range(static_cast<uint32_t>(new_contents.size()), 109 gfx::Range range(static_cast<uint32_t>(new_contents.size()),
107 static_cast<uint32_t>(name.size())); 110 static_cast<uint32_t>(name.size()));
108 prompt_->SetText(name); 111 prompt_->SetText(name);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 windows_.push_back(window); 203 windows_.push_back(window);
201 } 204 }
202 205
203 void QuickLaunch::Create(const service_manager::Identity& remote_identity, 206 void QuickLaunch::Create(const service_manager::Identity& remote_identity,
204 mojom::LaunchableRequest request) { 207 mojom::LaunchableRequest request) {
205 bindings_.AddBinding(this, std::move(request)); 208 bindings_.AddBinding(this, std::move(request));
206 } 209 }
207 210
208 } // namespace quick_launch 211 } // namespace quick_launch
209 } // namespace mash 212 } // namespace mash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698