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

Side by Side Diff: chrome/browser/ui/search_engines/template_url_table_model.cc

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
OLDNEW
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/search_engines/template_url_table_model.h" 5 #include "chrome/browser/ui/search_engines/template_url_table_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/task/cancelable_task_tracker.h" 9 #include "base/task/cancelable_task_tracker.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 254
255 void TemplateURLTableModel::Add(int index, 255 void TemplateURLTableModel::Add(int index,
256 const base::string16& short_name, 256 const base::string16& short_name,
257 const base::string16& keyword, 257 const base::string16& keyword,
258 const std::string& url) { 258 const std::string& url) {
259 DCHECK(index >= 0 && index <= RowCount()); 259 DCHECK(index >= 0 && index <= RowCount());
260 DCHECK(!url.empty()); 260 DCHECK(!url.empty());
261 template_url_service_->RemoveObserver(this); 261 template_url_service_->RemoveObserver(this);
262 TemplateURLData data; 262 TemplateURLData data;
263 data.short_name = short_name; 263 data.SetShortName(short_name);
264 data.SetKeyword(keyword); 264 data.SetKeyword(keyword);
265 data.SetURL(url); 265 data.SetURL(url);
266 TemplateURL* turl = new TemplateURL(data); 266 TemplateURL* turl = new TemplateURL(data);
267 template_url_service_->Add(turl); 267 template_url_service_->Add(turl);
268 scoped_ptr<ModelEntry> entry(new ModelEntry(this, turl)); 268 scoped_ptr<ModelEntry> entry(new ModelEntry(this, turl));
269 template_url_service_->AddObserver(this); 269 template_url_service_->AddObserver(this);
270 AddEntry(index, entry.Pass()); 270 AddEntry(index, entry.Pass());
271 } 271 }
272 272
273 void TemplateURLTableModel::ModifyTemplateURL(int index, 273 void TemplateURLTableModel::ModifyTemplateURL(int index,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return entry.Pass(); 383 return entry.Pass();
384 } 384 }
385 385
386 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) { 386 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) {
387 entries_.insert(entries_.begin() + index, entry.release()); 387 entries_.insert(entries_.begin() + index, entry.release());
388 if (index <= last_other_engine_index_) 388 if (index <= last_other_engine_index_)
389 ++last_other_engine_index_; 389 ++last_other_engine_index_;
390 if (observer_) 390 if (observer_)
391 observer_->OnItemsAdded(index, 1); 391 observer_->OnItemsAdded(index, 1);
392 } 392 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698