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 #ifndef CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "components/search_engines/template_url_service_observer.h" | 15 #include "components/search_engines/template_url_service_observer.h" |
16 #include "ui/base/models/table_model.h" | 16 #include "ui/base/models/table_model.h" |
17 | 17 |
18 class TemplateURL; | 18 class TemplateURL; |
19 class TemplateURLService; | 19 class TemplateURLService; |
20 | 20 |
21 namespace favicon { | 21 namespace favicon { |
22 class FaviconService; | 22 class FaviconService; |
23 } | 23 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 private: | 106 private: |
107 class ModelEntry; | 107 class ModelEntry; |
108 | 108 |
109 // Notification that a model entry has fetched its icon. | 109 // Notification that a model entry has fetched its icon. |
110 void FaviconAvailable(ModelEntry* entry); | 110 void FaviconAvailable(ModelEntry* entry); |
111 | 111 |
112 // TemplateURLServiceObserver notification. | 112 // TemplateURLServiceObserver notification. |
113 void OnTemplateURLServiceChanged() override; | 113 void OnTemplateURLServiceChanged() override; |
114 | 114 |
115 // Removes the entry at |index| from |entries_| and returns the removed item. | 115 // Removes the entry at |index| from |entries_| and returns the removed item. |
116 scoped_ptr<ModelEntry> RemoveEntry(int index); | 116 std::unique_ptr<ModelEntry> RemoveEntry(int index); |
117 | 117 |
118 // Adds |entry| to |entries_| at |index| and takes ownership. | 118 // Adds |entry| to |entries_| at |index| and takes ownership. |
119 void AddEntry(int index, scoped_ptr<ModelEntry> entry); | 119 void AddEntry(int index, std::unique_ptr<ModelEntry> entry); |
120 | 120 |
121 ui::TableModelObserver* observer_; | 121 ui::TableModelObserver* observer_; |
122 | 122 |
123 // The entries. | 123 // The entries. |
124 std::vector<ModelEntry*> entries_; | 124 std::vector<ModelEntry*> entries_; |
125 | 125 |
126 // The model we're displaying entries from. | 126 // The model we're displaying entries from. |
127 TemplateURLService* template_url_service_; | 127 TemplateURLService* template_url_service_; |
128 | 128 |
129 favicon::FaviconService* favicon_service_; | 129 favicon::FaviconService* favicon_service_; |
130 | 130 |
131 // Index of the last search engine in entries_. This is used to determine the | 131 // Index of the last search engine in entries_. This is used to determine the |
132 // group boundaries. | 132 // group boundaries. |
133 int last_search_engine_index_; | 133 int last_search_engine_index_; |
134 | 134 |
135 // Index of the last other engine in entries_. This is used to determine the | 135 // Index of the last other engine in entries_. This is used to determine the |
136 // group boundaries. | 136 // group boundaries. |
137 int last_other_engine_index_; | 137 int last_other_engine_index_; |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(TemplateURLTableModel); | 139 DISALLOW_COPY_AND_ASSIGN(TemplateURLTableModel); |
140 }; | 140 }; |
141 | 141 |
142 | 142 |
143 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ | 143 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ |
OLD | NEW |