Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "app/table_model.h" | 9 #include "app/table_model.h" |
| 10 #include "base/compiler_specific.h" | |
| 10 #include "base/string16.h" | 11 #include "base/string16.h" |
| 11 #include "chrome/browser/search_engines/template_url_model_observer.h" | 12 #include "chrome/browser/search_engines/template_url_model_observer.h" |
| 12 | 13 |
| 13 class ModelEntry; | 14 class ModelEntry; |
| 14 class SkBitmap; | 15 class SkBitmap; |
| 15 class TemplateURL; | 16 class TemplateURL; |
| 16 class TemplateURLModel; | 17 class TemplateURLModel; |
| 17 | 18 |
| 18 // TemplateURLTableModel is the TableModel implementation used by | 19 // TemplateURLTableModel is the TableModel implementation used by |
| 19 // KeywordEditorView to show the keywords in a TableView. | 20 // KeywordEditorView to show the keywords in a TableView. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 31 public: | 32 public: |
| 32 explicit TemplateURLTableModel(TemplateURLModel* template_url_model); | 33 explicit TemplateURLTableModel(TemplateURLModel* template_url_model); |
| 33 | 34 |
| 34 virtual ~TemplateURLTableModel(); | 35 virtual ~TemplateURLTableModel(); |
| 35 | 36 |
| 36 // Reloads the entries from the TemplateURLModel. This should ONLY be invoked | 37 // Reloads the entries from the TemplateURLModel. This should ONLY be invoked |
| 37 // if the TemplateURLModel wasn't initially loaded and has been loaded. | 38 // if the TemplateURLModel wasn't initially loaded and has been loaded. |
| 38 void Reload(); | 39 void Reload(); |
| 39 | 40 |
| 40 // TableModel overrides. | 41 // TableModel overrides. |
| 41 virtual int RowCount(); | 42 virtual int RowCount() OVERRIDE; |
| 42 virtual std::wstring GetText(int row, int column); | 43 virtual string16 GetText(int row, int column) OVERRIDE; |
| 43 virtual SkBitmap GetIcon(int row); | 44 virtual SkBitmap GetIcon(int row) OVERRIDE; |
| 44 virtual void SetObserver(TableModelObserver* observer); | 45 virtual void SetObserver(TableModelObserver* observer) OVERRIDE; |
| 45 virtual bool HasGroups(); | 46 virtual bool HasGroups() OVERRIDE; |
| 46 virtual Groups GetGroups(); | 47 virtual Groups GetGroups() OVERRIDE; |
| 47 virtual int GetGroupID(int row); | 48 virtual int GetGroupID(int row) OVERRIDE; |
| 48 | 49 |
| 49 // Removes the entry at the specified index. | 50 // Removes the entry at the specified index. |
| 50 void Remove(int index); | 51 void Remove(int index); |
| 51 | 52 |
| 52 // Adds a new entry at the specified index. | 53 // Adds a new entry at the specified index. |
| 53 void Add(int index, TemplateURL* template_url); | 54 void Add(int index, TemplateURL* template_url); |
| 54 | 55 |
| 55 // Update the entry at the specified index. | 56 // Update the entry at the specified index. |
| 56 void ModifyTemplateURL(int index, | 57 void ModifyTemplateURL(int index, |
| 57 const string16& title, | 58 const string16& title, |
| 58 const string16& keyword, | 59 const string16& keyword, |
| 59 const std::string& url); | 60 const std::string& url); |
|
viettrungluu
2010/12/29 23:41:17
Probably <string> should be included as a drive-by
Avi (use Gerrit)
2010/12/30 00:04:15
Done.
| |
| 60 | 61 |
| 61 // Reloads the icon at the specified index. | 62 // Reloads the icon at the specified index. |
| 62 void ReloadIcon(int index); | 63 void ReloadIcon(int index); |
| 63 | 64 |
| 64 // Returns The TemplateURL at the specified index. | 65 // Returns The TemplateURL at the specified index. |
| 65 const TemplateURL& GetTemplateURL(int index); | 66 const TemplateURL& GetTemplateURL(int index); |
| 66 | 67 |
| 67 // Returns the index of the TemplateURL, or -1 if it the TemplateURL is not | 68 // Returns the index of the TemplateURL, or -1 if it the TemplateURL is not |
| 68 // found. | 69 // found. |
| 69 int IndexOfTemplateURL(const TemplateURL* template_url); | 70 int IndexOfTemplateURL(const TemplateURL* template_url); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 90 | 91 |
| 91 // Notification that a model entry has fetched its icon. | 92 // Notification that a model entry has fetched its icon. |
| 92 void FavIconAvailable(ModelEntry* entry); | 93 void FavIconAvailable(ModelEntry* entry); |
| 93 | 94 |
| 94 // TemplateURLModelObserver notification. | 95 // TemplateURLModelObserver notification. |
| 95 virtual void OnTemplateURLModelChanged(); | 96 virtual void OnTemplateURLModelChanged(); |
| 96 | 97 |
| 97 TableModelObserver* observer_; | 98 TableModelObserver* observer_; |
| 98 | 99 |
| 99 // The entries. | 100 // The entries. |
| 100 std::vector<ModelEntry*> entries_; | 101 std::vector<ModelEntry*> entries_; |
|
viettrungluu
2010/12/29 23:41:17
And <vector> too, I guess.
Avi (use Gerrit)
2010/12/30 00:04:15
Done.
| |
| 101 | 102 |
| 102 // The model we're displaying entries from. | 103 // The model we're displaying entries from. |
| 103 TemplateURLModel* template_url_model_; | 104 TemplateURLModel* template_url_model_; |
| 104 | 105 |
| 105 // Index of the last search engine in entries_. This is used to determine the | 106 // Index of the last search engine in entries_. This is used to determine the |
| 106 // group boundaries. | 107 // group boundaries. |
| 107 int last_search_engine_index_; | 108 int last_search_engine_index_; |
| 108 | 109 |
| 109 DISALLOW_COPY_AND_ASSIGN(TemplateURLTableModel); | 110 DISALLOW_COPY_AND_ASSIGN(TemplateURLTableModel); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 | 113 |
| 113 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ | 114 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_ |
| OLD | NEW |