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

Side by Side Diff: chrome/browser/download/downloads_extension_api.h

Issue 7825035: Implement chrome.experimental.downloads.search() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rewrite Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/download/downloads_extension_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_DOWNLOAD_DOWNLOADS_EXTENSION_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOADS_EXTENSION_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_manager.h" 18 #include "content/browser/download/download_manager.h"
19 #include "content/browser/download/download_query.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 }
28 29
(...skipping 104 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(
146 base::DictionaryValue* json,
147 const char* json_name,
148 download_util::DownloadQuery::FilterFieldName filter_name);
149
150 download_util::DownloadQuery query_;
151 int get_id_;
152 bool has_get_id_;
153
143 DISALLOW_COPY_AND_ASSIGN(DownloadsSearchFunction); 154 DISALLOW_COPY_AND_ASSIGN(DownloadsSearchFunction);
144 }; 155 };
145 156
146 class DownloadsPauseFunction : public SyncDownloadsFunction { 157 class DownloadsPauseFunction : public SyncDownloadsFunction {
147 public: 158 public:
148 DownloadsPauseFunction(); 159 DownloadsPauseFunction();
149 virtual ~DownloadsPauseFunction(); 160 virtual ~DownloadsPauseFunction();
150 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.pause"); 161 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.pause");
151 162
152 protected: 163 protected:
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 void DispatchEvent(const char* event_name, base::Value* json_arg); 278 void DispatchEvent(const char* event_name, base::Value* json_arg);
268 typedef base::hash_map<int, DownloadItem*> ItemMap; 279 typedef base::hash_map<int, DownloadItem*> ItemMap;
269 typedef std::set<int> DownloadIdSet; 280 typedef std::set<int> DownloadIdSet;
270 281
271 Profile* profile_; 282 Profile* profile_;
272 DownloadManager* manager_; 283 DownloadManager* manager_;
273 DownloadIdSet downloads_; 284 DownloadIdSet downloads_;
274 285
275 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); 286 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter);
276 }; 287 };
277 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_ 288 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOADS_EXTENSION_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/downloads_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698