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

Side by Side Diff: chrome/browser/extensions/extension_downloads_api.h

Issue 7825035: Implement chrome.experimental.downloads.search() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: comments Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
17 #include "content/browser/download/download_item.h" 17 #include "content/browser/download/download_item.h"
18 #include "content/browser/download/download_query.h"
18 #include "content/browser/download/download_manager.h" 19 #include "content/browser/download/download_manager.h"
19 20
20 namespace base { 21 namespace base {
21 class DictionaryValue; 22 class DictionaryValue;
22 } 23 }
23 class ResourceDispatcherHost; 24 class ResourceDispatcherHost;
24 class TabContents; 25 class TabContents;
25 namespace content { 26 namespace content {
26 class ResourceContext; 27 class ResourceContext;
27 } 28 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 public: 134 public:
134 DownloadsSearchFunction(); 135 DownloadsSearchFunction();
135 virtual ~DownloadsSearchFunction(); 136 virtual ~DownloadsSearchFunction();
136 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.search"); 137 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.search");
137 138
138 protected: 139 protected:
139 virtual bool ParseArgs() OVERRIDE; 140 virtual bool ParseArgs() OVERRIDE;
140 virtual void RunInternal() OVERRIDE; 141 virtual void RunInternal() OVERRIDE;
141 142
142 private: 143 private:
144 template <typename ValueType>
145 bool Parse(base::DictionaryValue* json, const char* name);
146
147 download_util::DownloadQuery query_;
148 int get_id_;
149 bool has_get_id_;
150
143 DISALLOW_COPY_AND_ASSIGN(DownloadsSearchFunction); 151 DISALLOW_COPY_AND_ASSIGN(DownloadsSearchFunction);
144 }; 152 };
145 153
146 class DownloadsPauseFunction : public SyncDownloadsFunction { 154 class DownloadsPauseFunction : public SyncDownloadsFunction {
147 public: 155 public:
148 DownloadsPauseFunction(); 156 DownloadsPauseFunction();
149 virtual ~DownloadsPauseFunction(); 157 virtual ~DownloadsPauseFunction();
150 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.pause"); 158 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.pause");
151 159
152 protected: 160 protected:
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 typedef base::hash_map<int, DownloadItem*> ItemMap; 276 typedef base::hash_map<int, DownloadItem*> ItemMap;
269 typedef std::set<int> DownloadIdSet; 277 typedef std::set<int> DownloadIdSet;
270 278
271 Profile* profile_; 279 Profile* profile_;
272 DownloadManager* manager_; 280 DownloadManager* manager_;
273 DownloadIdSet downloads_; 281 DownloadIdSet downloads_;
274 282
275 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); 283 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter);
276 }; 284 };
277 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_ 285 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698