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

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

Issue 10173001: Add a Profile* member to TemplateURL. This makes some invocations of ReplaceSearchTerms() a bit le… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 const string16& short_name, 252 const string16& short_name,
253 const string16& keyword, 253 const string16& keyword,
254 const std::string& url) { 254 const std::string& url) {
255 DCHECK(index >= 0 && index <= RowCount()); 255 DCHECK(index >= 0 && index <= RowCount());
256 DCHECK(!url.empty()); 256 DCHECK(!url.empty());
257 template_url_service_->RemoveObserver(this); 257 template_url_service_->RemoveObserver(this);
258 TemplateURLData data; 258 TemplateURLData data;
259 data.short_name = short_name; 259 data.short_name = short_name;
260 data.SetKeyword(keyword); 260 data.SetKeyword(keyword);
261 data.SetURL(url); 261 data.SetURL(url);
262 TemplateURL* turl = new TemplateURL(data); 262 TemplateURL* turl = new TemplateURL(template_url_service_->profile(), data);
263 template_url_service_->Add(turl); 263 template_url_service_->Add(turl);
264 ModelEntry* entry = new ModelEntry(this, turl); 264 ModelEntry* entry = new ModelEntry(this, turl);
265 template_url_service_->AddObserver(this); 265 template_url_service_->AddObserver(this);
266 entries_.insert(entries_.begin() + index, entry); 266 entries_.insert(entries_.begin() + index, entry);
267 if (observer_) 267 if (observer_)
268 observer_->OnItemsAdded(index, 1); 268 observer_->OnItemsAdded(index, 1);
269 } 269 }
270 270
271 void TemplateURLTableModel::ModifyTemplateURL(int index, 271 void TemplateURLTableModel::ModifyTemplateURL(int index,
272 const string16& title, 272 const string16& title,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) { 365 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) {
366 std::vector<ModelEntry*>::iterator i = 366 std::vector<ModelEntry*>::iterator i =
367 std::find(entries_.begin(), entries_.end(), entry); 367 std::find(entries_.begin(), entries_.end(), entry);
368 DCHECK(i != entries_.end()); 368 DCHECK(i != entries_.end());
369 NotifyChanged(static_cast<int>(i - entries_.begin())); 369 NotifyChanged(static_cast<int>(i - entries_.begin()));
370 } 370 }
371 371
372 void TemplateURLTableModel::OnTemplateURLServiceChanged() { 372 void TemplateURLTableModel::OnTemplateURLServiceChanged() {
373 Reload(); 373 Reload();
374 } 374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698