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

Side by Side Diff: chrome/browser/extensions/api/browsing_data/browsing_data_api.cc

Issue 2578723002: Reduce BrowsingDataRemover's dependencies on Chrome (Closed)
Patch Set: A new callsite appeared through rebase - fixed the compilation error. Created 3 years, 11 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 // Defines the Chrome Extensions BrowsingData API functions, which entail 5 // Defines the Chrome Extensions BrowsingData API functions, which entail
6 // clearing browsing data, and clearing the browser's cache (which, let's be 6 // clearing browsing data, and clearing the browser's cache (which, let's be
7 // honest, are the same thing), as specified in the extension API JSON. 7 // honest, are the same thing), as specified in the extension API JSON.
8 8
9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" 9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h"
10 10
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/browsing_data/browsing_data_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_remover.h" 16 #include "chrome/browser/browsing_data/browsing_data_remover.h"
17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
18 #include "chrome/browser/plugins/plugin_data_remover_helper.h" 18 #include "chrome/browser/plugins/plugin_data_remover_helper.h"
19 #include "chrome/browser/plugins/plugin_prefs.h" 19 #include "chrome/browser/plugins/plugin_prefs.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "components/browsing_data/core/browsing_data_utils.h"
23 #include "components/browsing_data/core/pref_names.h" 24 #include "components/browsing_data/core/pref_names.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "extensions/common/error_utils.h" 26 #include "extensions/common/error_utils.h"
26 #include "extensions/common/extension.h" 27 #include "extensions/common/extension.h"
27 28
28 using content::BrowserThread; 29 using content::BrowserThread;
29 30
30 namespace extension_browsing_data_api_constants { 31 namespace extension_browsing_data_api_constants {
31 32
32 // Parameter name keys. 33 // Parameter name keys.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 BrowsingDataRemoverFactory::GetForBrowserContext(GetProfile()); 314 BrowsingDataRemoverFactory::GetForBrowserContext(GetProfile());
314 // Add a ref (Balanced in OnBrowsingDataRemoverDone) 315 // Add a ref (Balanced in OnBrowsingDataRemoverDone)
315 AddRef(); 316 AddRef();
316 317
317 // Create a BrowsingDataRemover, set the current object as an observer (so 318 // Create a BrowsingDataRemover, set the current object as an observer (so
318 // that we're notified after removal) and call remove() with the arguments 319 // that we're notified after removal) and call remove() with the arguments
319 // we've generated above. We can use a raw pointer here, as the browsing data 320 // we've generated above. We can use a raw pointer here, as the browsing data
320 // remover is responsible for deleting itself once data removal is complete. 321 // remover is responsible for deleting itself once data removal is complete.
321 observer_.Add(remover); 322 observer_.Add(remover);
322 remover->RemoveAndReply( 323 remover->RemoveAndReply(
323 BrowsingDataRemover::TimeRange(remove_since_, base::Time::Max()), 324 remove_since_, base::Time::Max(),
324 removal_mask_, origin_type_mask_, this); 325 removal_mask_, origin_type_mask_, this);
325 } 326 }
326 327
327 int BrowsingDataRemoverFunction::ParseOriginTypeMask( 328 int BrowsingDataRemoverFunction::ParseOriginTypeMask(
328 const base::DictionaryValue& options) { 329 const base::DictionaryValue& options) {
329 // Parse the |options| dictionary to generate the origin set mask. Default to 330 // Parse the |options| dictionary to generate the origin set mask. Default to
330 // UNPROTECTED_WEB if the developer doesn't specify anything. 331 // UNPROTECTED_WEB if the developer doesn't specify anything.
331 int mask = BrowsingDataHelper::UNPROTECTED_WEB; 332 int mask = BrowsingDataHelper::UNPROTECTED_WEB;
332 333
333 const base::DictionaryValue* d = NULL; 334 const base::DictionaryValue* d = NULL;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; 442 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS;
442 } 443 }
443 444
444 int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() { 445 int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() {
445 return BrowsingDataRemover::REMOVE_CACHE_STORAGE; 446 return BrowsingDataRemover::REMOVE_CACHE_STORAGE;
446 } 447 }
447 448
448 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() { 449 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() {
449 return BrowsingDataRemover::REMOVE_WEBSQL; 450 return BrowsingDataRemover::REMOVE_WEBSQL;
450 } 451 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/profiles/profile_helper.cc ('k') | chrome/browser/extensions/api/browsing_data/browsing_data_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698