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

Side by Side Diff: chrome/browser/ui/webui/md_downloads/downloads_list_tracker.h

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_
6 #define CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
10 #include <set> 11 #include <set>
11 12
12 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/download/all_download_item_notifier.h" 18 #include "chrome/browser/download/all_download_item_notifier.h"
19 #include "content/public/browser/download_item.h" 19 #include "content/public/browser/download_item.h"
20 20
21 namespace base { 21 namespace base {
22 class DictionaryValue; 22 class DictionaryValue;
23 class ListValue; 23 class ListValue;
24 } 24 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void OnDownloadRemoved(content::DownloadManager* manager, 63 void OnDownloadRemoved(content::DownloadManager* manager,
64 content::DownloadItem* download_item) override; 64 content::DownloadItem* download_item) override;
65 65
66 protected: 66 protected:
67 // Testing constructor. 67 // Testing constructor.
68 DownloadsListTracker(content::DownloadManager* download_manager, 68 DownloadsListTracker(content::DownloadManager* download_manager,
69 content::WebUI* web_ui, 69 content::WebUI* web_ui,
70 base::Callback<bool(const content::DownloadItem&)>); 70 base::Callback<bool(const content::DownloadItem&)>);
71 71
72 // Creates a dictionary value that's sent to the page as JSON. 72 // Creates a dictionary value that's sent to the page as JSON.
73 virtual scoped_ptr<base::DictionaryValue> CreateDownloadItemValue( 73 virtual std::unique_ptr<base::DictionaryValue> CreateDownloadItemValue(
74 content::DownloadItem* item) const; 74 content::DownloadItem* item) const;
75 75
76 // Exposed for testing. 76 // Exposed for testing.
77 bool IsIncognito(const content::DownloadItem& item) const; 77 bool IsIncognito(const content::DownloadItem& item) const;
78 78
79 const content::DownloadItem* GetItemForTesting(size_t index) const; 79 const content::DownloadItem* GetItemForTesting(size_t index) const;
80 80
81 void SetChunkSizeForTesting(size_t chunk_size); 81 void SetChunkSizeForTesting(size_t chunk_size);
82 82
83 private: 83 private:
(...skipping 19 matching lines...) Expand all
103 void InsertItem(const SortedSet::iterator& insert); 103 void InsertItem(const SortedSet::iterator& insert);
104 104
105 // Calls "updateItem" if sending updates and the page knows about |update|. 105 // Calls "updateItem" if sending updates and the page knows about |update|.
106 void UpdateItem(const SortedSet::iterator& update); 106 void UpdateItem(const SortedSet::iterator& update);
107 107
108 // Removes the item that corresponds to |remove| and sends "removeItems" 108 // Removes the item that corresponds to |remove| and sends "removeItems"
109 // if sending updates. 109 // if sending updates.
110 void RemoveItem(const SortedSet::iterator& remove); 110 void RemoveItem(const SortedSet::iterator& remove);
111 111
112 AllDownloadItemNotifier main_notifier_; 112 AllDownloadItemNotifier main_notifier_;
113 scoped_ptr<AllDownloadItemNotifier> original_notifier_; 113 std::unique_ptr<AllDownloadItemNotifier> original_notifier_;
114 114
115 // The WebUI object corresponding to the page we care about. 115 // The WebUI object corresponding to the page we care about.
116 content::WebUI* const web_ui_; 116 content::WebUI* const web_ui_;
117 117
118 // Callback used to determine if an item should show on the page. Set to 118 // Callback used to determine if an item should show on the page. Set to
119 // |ShouldShow()| in default constructor, passed in while testing. 119 // |ShouldShow()| in default constructor, passed in while testing.
120 base::Callback<bool(const content::DownloadItem&)> should_show_; 120 base::Callback<bool(const content::DownloadItem&)> should_show_;
121 121
122 // When this is true, all changes to downloads that affect the page are sent 122 // When this is true, all changes to downloads that affect the page are sent
123 // via JavaScript. 123 // via JavaScript.
124 bool sending_updates_ = false; 124 bool sending_updates_ = false;
125 125
126 SortedSet sorted_items_; 126 SortedSet sorted_items_;
127 127
128 // The number of items sent to the page so far. 128 // The number of items sent to the page so far.
129 size_t sent_to_page_ = 0u; 129 size_t sent_to_page_ = 0u;
130 130
131 // The maximum number of items sent to the page at a time. 131 // The maximum number of items sent to the page at a time.
132 size_t chunk_size_ = 20u; 132 size_t chunk_size_ = 20u;
133 133
134 // Current search terms. 134 // Current search terms.
135 std::vector<base::string16> search_terms_; 135 std::vector<base::string16> search_terms_;
136 136
137 DISALLOW_COPY_AND_ASSIGN(DownloadsListTracker); 137 DISALLOW_COPY_AND_ASSIGN(DownloadsListTracker);
138 }; 138 };
139 139
140 #endif // CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ 140 #endif // CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/local_state/local_state_ui.cc ('k') | chrome/browser/ui/webui/md_downloads/downloads_list_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698