OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
14 #include "components/search_engines/template_url.h" | 14 #include "components/search_engines/template_url.h" |
15 #include "components/search_engines/template_url_service.h" | 15 #include "components/search_engines/template_url_service.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/models/table_model_observer.h" | 17 #include "ui/base/models/table_model_observer.h" |
18 #include "ui/resources/grit/ui_resources.h" | |
19 | 18 |
20 // Group IDs used by TemplateURLTableModel. | 19 // Group IDs used by TemplateURLTableModel. |
21 static const int kMainGroupID = 0; | 20 static const int kMainGroupID = 0; |
22 static const int kOtherGroupID = 1; | 21 static const int kOtherGroupID = 1; |
23 static const int kExtensionGroupID = 2; | 22 static const int kExtensionGroupID = 2; |
24 | 23 |
25 TemplateURLTableModel::TemplateURLTableModel( | 24 TemplateURLTableModel::TemplateURLTableModel( |
26 TemplateURLService* template_url_service) | 25 TemplateURLService* template_url_service) |
27 : observer_(NULL), template_url_service_(template_url_service) { | 26 : observer_(NULL), template_url_service_(template_url_service) { |
28 DCHECK(template_url_service); | 27 DCHECK(template_url_service); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return entry; | 256 return entry; |
258 } | 257 } |
259 | 258 |
260 void TemplateURLTableModel::AddEntry(int index, TemplateURL* entry) { | 259 void TemplateURLTableModel::AddEntry(int index, TemplateURL* entry) { |
261 entries_.insert(entries_.begin() + index, entry); | 260 entries_.insert(entries_.begin() + index, entry); |
262 if (index <= last_other_engine_index_) | 261 if (index <= last_other_engine_index_) |
263 ++last_other_engine_index_; | 262 ++last_other_engine_index_; |
264 if (observer_) | 263 if (observer_) |
265 observer_->OnItemsAdded(index, 1); | 264 observer_->OnItemsAdded(index, 1); |
266 } | 265 } |
OLD | NEW |