| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_BOOKMARKS_BOOKMARK_TABLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_TABLE_MODEL_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_TABLE_MODEL_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_TABLE_MODEL_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 | 10 |
| 11 #if defined(TOOLKIT_VIEWS) | 11 #if defined(TOOLKIT_VIEWS) |
| 12 #include "views/controls/table/table_model.h" | 12 #include "views/controls/table/table_model.h" |
| 13 #else | 13 #else |
| 14 #include "chrome/common/temp_scaffolding_stubs.h" | 14 #include "chrome/common/temp_scaffolding_stubs.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 // BookmarkTableModel provides a view of the BookmarkModel as a TableModel. | 17 // BookmarkTableModel provides a view of the BookmarkModel as a TableModel. |
| 18 // Three variations are provided: | 18 // Three variations are provided: |
| 19 // . Recently created bookmarks. | 19 // . Recently created bookmarks. |
| 20 // . The children of a particular folder. | 20 // . The children of a particular folder. |
| 21 // . All bookmarks matching the specified text. | 21 // . All bookmarks matching the specified text. |
| 22 class BookmarkTableModel : public views::TableModel, | 22 class BookmarkTableModel : public views::TableModel, |
| 23 public BookmarkModelObserver { | 23 public BookmarkModelObserver { |
| 24 public: | 24 public: |
| 25 // Methods for creating the various BookmarkTableModels. Ownership passes | 25 // Methods for creating the various BookmarkTableModels. Ownership passes |
| 26 // to the caller. | 26 // to the caller. |
| 27 // |languages| is the kAcceptLanguages value of the user preference. It is |
| 28 // used to decode IDN. |
| 27 static BookmarkTableModel* CreateRecentlyBookmarkedModel( | 29 static BookmarkTableModel* CreateRecentlyBookmarkedModel( |
| 28 BookmarkModel* model); | 30 BookmarkModel* model); |
| 29 static BookmarkTableModel* CreateBookmarkTableModelForFolder( | 31 static BookmarkTableModel* CreateBookmarkTableModelForFolder( |
| 30 BookmarkModel* model, BookmarkNode* node); | 32 BookmarkModel* model, BookmarkNode* node); |
| 31 static BookmarkTableModel* CreateSearchTableModel( | 33 static BookmarkTableModel* CreateSearchTableModel( |
| 32 BookmarkModel* model, | 34 BookmarkModel* model, |
| 33 const std::wstring& text); | 35 const std::wstring& text, |
| 36 const std::wstring& languages); |
| 34 | 37 |
| 35 explicit BookmarkTableModel(BookmarkModel* model); | 38 explicit BookmarkTableModel(BookmarkModel* model); |
| 36 virtual ~BookmarkTableModel(); | 39 virtual ~BookmarkTableModel(); |
| 37 | 40 |
| 38 // TableModel methods. | 41 // TableModel methods. |
| 39 virtual std::wstring GetText(int row, int column_id); | 42 virtual std::wstring GetText(int row, int column_id); |
| 40 virtual SkBitmap GetIcon(int row); | 43 virtual SkBitmap GetIcon(int row); |
| 41 virtual void SetObserver(views::TableModelObserver* observer) { | 44 virtual void SetObserver(views::TableModelObserver* observer) { |
| 42 observer_ = observer; | 45 observer_ = observer; |
| 43 } | 46 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 66 // Builds the path shown in the path column for the specified node. | 69 // Builds the path shown in the path column for the specified node. |
| 67 void BuildPath(BookmarkNode* node, std::wstring* path); | 70 void BuildPath(BookmarkNode* node, std::wstring* path); |
| 68 | 71 |
| 69 BookmarkModel* model_; | 72 BookmarkModel* model_; |
| 70 views::TableModelObserver* observer_; | 73 views::TableModelObserver* observer_; |
| 71 | 74 |
| 72 DISALLOW_COPY_AND_ASSIGN(BookmarkTableModel); | 75 DISALLOW_COPY_AND_ASSIGN(BookmarkTableModel); |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_TABLE_MODEL_H_ | 78 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_TABLE_MODEL_H_ |
| OLD | NEW |