| 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_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ |
| 6 #define CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ | 6 #define CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
| 13 #include "components/history/core/browser/history_types.h" | 13 #include "components/history/core/browser/history_types.h" |
| 14 #include "ui/base/models/table_model.h" | 14 #include "ui/base/models/table_model.h" |
| 15 | 15 |
| 16 class Browser; |
| 16 class GURL; | 17 class GURL; |
| 17 class Profile; | 18 class Profile; |
| 18 | 19 |
| 19 namespace history { | 20 namespace history { |
| 20 class URLRow; | 21 class URLRow; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace ui { | 24 namespace ui { |
| 24 class TableModelObserver; | 25 class TableModelObserver; |
| 25 } | 26 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 int RowCount() override; | 58 int RowCount() override; |
| 58 base::string16 GetText(int row, int column_id) override; | 59 base::string16 GetText(int row, int column_id) override; |
| 59 base::string16 GetTooltip(int row) override; | 60 base::string16 GetTooltip(int row) override; |
| 60 void SetObserver(ui::TableModelObserver* observer) override; | 61 void SetObserver(ui::TableModelObserver* observer) override; |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 // Each item in the model is represented as an Entry. Entry stores the URL | 64 // Each item in the model is represented as an Entry. Entry stores the URL |
| 64 // and title of the page. | 65 // and title of the page. |
| 65 struct Entry; | 66 struct Entry; |
| 66 | 67 |
| 68 // Returns false if pages from |browser| should not be considered. |
| 69 bool ShouldIncludeBrowser(Browser* browser); |
| 70 |
| 67 // Loads the title for the specified entry. | 71 // Loads the title for the specified entry. |
| 68 void LoadTitle(Entry* entry); | 72 void LoadTitle(Entry* entry); |
| 69 | 73 |
| 70 // Loads all the titles, notifies the observer of the change once all loads | 74 // Loads all the titles, notifies the observer of the change once all loads |
| 71 // are complete. | 75 // are complete. |
| 72 void LoadAllTitles(); | 76 void LoadAllTitles(); |
| 73 | 77 |
| 74 // Callback from history service. Updates the title of the Entry whose | 78 // Callback from history service. Updates the title of the Entry whose |
| 75 // |url| matches |entry_url| and notifies the observer of the change if | 79 // |url| matches |entry_url| and notifies the observer of the change if |
| 76 // |observable| is true. | 80 // |observable| is true. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 base::CancelableTaskTracker task_tracker_; | 113 base::CancelableTaskTracker task_tracker_; |
| 110 | 114 |
| 111 // Used to keep track of when it's time to update the observer when loading | 115 // Used to keep track of when it's time to update the observer when loading |
| 112 // multiple titles. | 116 // multiple titles. |
| 113 int num_outstanding_title_lookups_; | 117 int num_outstanding_title_lookups_; |
| 114 | 118 |
| 115 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel); | 119 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel); |
| 116 }; | 120 }; |
| 117 | 121 |
| 118 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ | 122 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ |
| OLD | NEW |