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

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

Issue 338363004: Remove Profile* from TemplateURL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 6 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 | Annotate | Revision Log
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/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 const base::string16& short_name, 267 const base::string16& short_name,
268 const base::string16& keyword, 268 const base::string16& keyword,
269 const std::string& url) { 269 const std::string& url) {
270 DCHECK(index >= 0 && index <= RowCount()); 270 DCHECK(index >= 0 && index <= RowCount());
271 DCHECK(!url.empty()); 271 DCHECK(!url.empty());
272 template_url_service_->RemoveObserver(this); 272 template_url_service_->RemoveObserver(this);
273 TemplateURLData data; 273 TemplateURLData data;
274 data.short_name = short_name; 274 data.short_name = short_name;
275 data.SetKeyword(keyword); 275 data.SetKeyword(keyword);
276 data.SetURL(url); 276 data.SetURL(url);
277 TemplateURL* turl = new TemplateURL(template_url_service_->profile(), data); 277 TemplateURL* turl = new TemplateURL(data);
278 template_url_service_->Add(turl); 278 template_url_service_->Add(turl);
279 scoped_ptr<ModelEntry> entry(new ModelEntry(this, turl)); 279 scoped_ptr<ModelEntry> entry(new ModelEntry(this, turl));
280 template_url_service_->AddObserver(this); 280 template_url_service_->AddObserver(this);
281 AddEntry(index, entry.Pass()); 281 AddEntry(index, entry.Pass());
282 } 282 }
283 283
284 void TemplateURLTableModel::ModifyTemplateURL(int index, 284 void TemplateURLTableModel::ModifyTemplateURL(int index,
285 const base::string16& title, 285 const base::string16& title,
286 const base::string16& keyword, 286 const base::string16& keyword,
287 const std::string& url) { 287 const std::string& url) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return entry.Pass(); 393 return entry.Pass();
394 } 394 }
395 395
396 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) { 396 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) {
397 entries_.insert(entries_.begin() + index, entry.release()); 397 entries_.insert(entries_.begin() + index, entry.release());
398 if (index <= last_other_engine_index_) 398 if (index <= last_other_engine_index_)
399 ++last_other_engine_index_; 399 ++last_other_engine_index_;
400 if (observer_) 400 if (observer_)
401 observer_->OnItemsAdded(index, 1); 401 observer_->OnItemsAdded(index, 1);
402 } 402 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search_engines/search_engine_tab_helper.cc ('k') | chrome/browser/webdata/keyword_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698