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

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

Issue 314293005: Change HistoryService::QueryURL to use CancelableTaskTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add comment for scoped_ptr usage Created 6 years, 6 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
OLDNEW
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 "chrome/browser/history/history_service.h" 12 #include "base/task/cancelable_task_tracker.h"
13 #include "chrome/browser/history/history_types.h"
13 #include "ui/base/models/table_model.h" 14 #include "ui/base/models/table_model.h"
14 15
15 class GURL; 16 class GURL;
16 class Profile; 17 class Profile;
18 class HistoryService;
19
20 namespace history {
21 class URLRow;
22 }
17 23
18 namespace ui { 24 namespace ui {
19 class TableModelObserver; 25 class TableModelObserver;
20 } 26 }
21 27
22 // CustomHomePagesTableModel is the model for the TableView showing the list 28 // CustomHomePagesTableModel is the model for the TableView showing the list
23 // of pages the user wants opened on startup. 29 // of pages the user wants opened on startup.
24 30
25 class CustomHomePagesTableModel : public ui::TableModel { 31 class CustomHomePagesTableModel : public ui::TableModel {
26 public: 32 public:
(...skipping 29 matching lines...) Expand all
56 62
57 private: 63 private:
58 // 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
59 // and title of the page. 65 // and title of the page.
60 struct Entry; 66 struct Entry;
61 67
62 // Loads the title for the specified entry. 68 // Loads the title for the specified entry.
63 void LoadTitle(Entry* entry); 69 void LoadTitle(Entry* entry);
64 70
65 // Callback from history service. Updates the title of the Entry whose 71 // Callback from history service. Updates the title of the Entry whose
66 // |title_handle| matches |handle| and notifies the observer of the change. 72 // |url| matches |entry_url| and notifies the observer of the change.
67 void OnGotTitle(HistoryService::Handle handle, 73 void OnGotTitle(const GURL& entry_url,
68 bool found_url, 74 bool found_url,
69 const history::URLRow* row, 75 const history::URLRow& row,
70 history::VisitVector* visits); 76 const history::VisitVector& visits);
71
72 // Returns the entry whose |member| matches |handle| and sets |entry_index| to
73 // the index of the entry.
74 Entry* GetEntryByLoadHandle(CancelableRequestProvider::Handle Entry::* member,
75 CancelableRequestProvider::Handle handle,
76 int* entry_index);
77 77
78 // Returns the URL for a particular row, formatted for display to the user. 78 // Returns the URL for a particular row, formatted for display to the user.
79 base::string16 FormattedURL(int row) const; 79 base::string16 FormattedURL(int row) const;
80 80
81 // Set of entries we're showing. 81 // Set of entries we're showing.
82 std::vector<Entry> entries_; 82 std::vector<Entry> entries_;
83 83
84 // Profile used to load titles. 84 // Profile used to load titles.
85 Profile* profile_; 85 Profile* profile_;
86 86
87 ui::TableModelObserver* observer_; 87 ui::TableModelObserver* observer_;
88 88
89 // Used in loading titles. 89 // Used in loading titles.
90 CancelableRequestConsumer history_query_consumer_; 90 base::CancelableTaskTracker task_tracker_;
91 91
92 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel); 92 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel);
93 }; 93 };
94 94
95 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ 95 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698