Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/browser/custom_home_pages_table_model.h

Issue 6044007: Remove wstring from TableModel.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
viettrungluu 2010/12/29 23:41:17 No longer needed, but should probably include base
Avi (use Gerrit) 2010/12/30 00:04:15 No, overrides TableModel which includes.
viettrungluu 2010/12/30 00:35:13 I would include it because of the standalone use (
10 #include <vector> 10 #include <vector>
11 11
12 #include "app/table_model.h" 12 #include "app/table_model.h"
13 #include "base/compiler_specific.h"
13 #include "chrome/browser/history/history.h" 14 #include "chrome/browser/history/history.h"
14 #include "chrome/browser/favicon_service.h" 15 #include "chrome/browser/favicon_service.h"
15 16
16 class GURL; 17 class GURL;
17 class Profile; 18 class Profile;
18 class SkBitmap; 19 class SkBitmap;
19 class TableModelObserver; 20 class TableModelObserver;
20 21
21 // CustomHomePagesTableModel is the model for the TableView showing the list 22 // CustomHomePagesTableModel is the model for the TableView showing the list
22 // of pages the user wants opened on startup. 23 // of pages the user wants opened on startup.
(...skipping 13 matching lines...) Expand all
36 void Remove(int index); 37 void Remove(int index);
37 38
38 // Clears any entries and fills the list with pages currently opened in the 39 // Clears any entries and fills the list with pages currently opened in the
39 // browser. 40 // browser.
40 void SetToCurrentlyOpenPages(); 41 void SetToCurrentlyOpenPages();
41 42
42 // Returns the set of urls this model contains. 43 // Returns the set of urls this model contains.
43 std::vector<GURL> GetURLs(); 44 std::vector<GURL> GetURLs();
44 45
45 // TableModel overrides: 46 // TableModel overrides:
46 virtual int RowCount(); 47 virtual int RowCount() OVERRIDE;
47 virtual std::wstring GetText(int row, int column_id); 48 virtual string16 GetText(int row, int column_id) OVERRIDE;
48 virtual SkBitmap GetIcon(int row); 49 virtual SkBitmap GetIcon(int row) OVERRIDE;
49 virtual std::wstring GetTooltip(int row); 50 virtual string16 GetTooltip(int row) OVERRIDE;
50 virtual void SetObserver(TableModelObserver* observer); 51 virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
51 52
52 private: 53 private:
53 // Each item in the model is represented as an Entry. Entry stores the URL, 54 // Each item in the model is represented as an Entry. Entry stores the URL,
54 // title, and favicon of the page. 55 // title, and favicon of the page.
55 struct Entry; 56 struct Entry;
56 57
57 // Loads the title and favicon for the specified entry. 58 // Loads the title and favicon for the specified entry.
58 void LoadTitleAndFavIcon(Entry* entry); 59 void LoadTitleAndFavIcon(Entry* entry);
59 60
60 // Callback from history service. Updates the title of the Entry whose 61 // Callback from history service. Updates the title of the Entry whose
(...skipping 16 matching lines...) Expand all
77 Entry* GetEntryByLoadHandle(CancelableRequestProvider::Handle Entry::* member, 78 Entry* GetEntryByLoadHandle(CancelableRequestProvider::Handle Entry::* member,
78 CancelableRequestProvider::Handle handle, 79 CancelableRequestProvider::Handle handle,
79 int* entry_index); 80 int* entry_index);
80 81
81 // Returns the entry whose |fav_icon_handle| matches |handle| and sets 82 // Returns the entry whose |fav_icon_handle| matches |handle| and sets
82 // |entry_index| to the index of the entry. 83 // |entry_index| to the index of the entry.
83 Entry* GetEntryByFavIconHandle(FaviconService::Handle handle, 84 Entry* GetEntryByFavIconHandle(FaviconService::Handle handle,
84 int* entry_index); 85 int* entry_index);
85 86
86 // Returns the URL for a particular row, formatted for display to the user. 87 // Returns the URL for a particular row, formatted for display to the user.
87 std::wstring FormattedURL(int row) const; 88 string16 FormattedURL(int row) const;
88 89
89 // Set of entries we're showing. 90 // Set of entries we're showing.
90 std::vector<Entry> entries_; 91 std::vector<Entry> entries_;
91 92
92 // Default icon to show when one can't be found for the URL. 93 // Default icon to show when one can't be found for the URL.
93 SkBitmap* default_favicon_; 94 SkBitmap* default_favicon_;
94 95
95 // Profile used to load titles and icons. 96 // Profile used to load titles and icons.
96 Profile* profile_; 97 Profile* profile_;
97 98
98 TableModelObserver* observer_; 99 TableModelObserver* observer_;
99 100
100 // Used in loading titles and favicons. 101 // Used in loading titles and favicons.
101 CancelableRequestConsumer query_consumer_; 102 CancelableRequestConsumer query_consumer_;
102 103
103 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel); 104 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel);
104 }; 105 };
105 106
106 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ 107 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698