| OLD | NEW |
| 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 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 const char kSinceKey[] = "since"; | 47 const char kSinceKey[] = "since"; |
| 48 const char kUnprotectedWebKey[] = "unprotectedWeb"; | 48 const char kUnprotectedWebKey[] = "unprotectedWeb"; |
| 49 | 49 |
| 50 // Errors! | 50 // Errors! |
| 51 const char kOneAtATimeError[] = "Only one 'browsingData' API call can run at " | 51 const char kOneAtATimeError[] = "Only one 'browsingData' API call can run at " |
| 52 "a time."; | 52 "a time."; |
| 53 | 53 |
| 54 } // namespace extension_browsing_data_api_constants | 54 } // namespace extension_browsing_data_api_constants |
| 55 | 55 |
| 56 namespace { | 56 namespace { |
| 57 // Converts the JavaScript API's numeric input (miliseconds since epoch) into an | |
| 58 // appropriate base::Time that we can pass into the BrowsingDataRemove. | |
| 59 bool ParseTimeFromValue(const double& ms_since_epoch, base::Time* time) { | |
| 60 return true; | |
| 61 } | |
| 62 | |
| 63 // Given a DictionaryValue |dict|, returns either the value stored as |key|, or | 57 // Given a DictionaryValue |dict|, returns either the value stored as |key|, or |
| 64 // false, if the given key doesn't exist in the dictionary. | 58 // false, if the given key doesn't exist in the dictionary. |
| 65 bool RemoveType(base::DictionaryValue* dict, const std::string& key) { | 59 bool RemoveType(base::DictionaryValue* dict, const std::string& key) { |
| 66 bool value = false; | 60 bool value = false; |
| 67 if (!dict->GetBoolean(key, &value)) | 61 if (!dict->GetBoolean(key, &value)) |
| 68 return false; | 62 return false; |
| 69 else | 63 else |
| 70 return value; | 64 return value; |
| 71 } | 65 } |
| 72 | 66 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return BrowsingDataRemover::REMOVE_PLUGIN_DATA; | 275 return BrowsingDataRemover::REMOVE_PLUGIN_DATA; |
| 282 } | 276 } |
| 283 | 277 |
| 284 int RemovePasswordsFunction::GetRemovalMask() const { | 278 int RemovePasswordsFunction::GetRemovalMask() const { |
| 285 return BrowsingDataRemover::REMOVE_PASSWORDS; | 279 return BrowsingDataRemover::REMOVE_PASSWORDS; |
| 286 } | 280 } |
| 287 | 281 |
| 288 int RemoveWebSQLFunction::GetRemovalMask() const { | 282 int RemoveWebSQLFunction::GetRemovalMask() const { |
| 289 return BrowsingDataRemover::REMOVE_WEBSQL; | 283 return BrowsingDataRemover::REMOVE_WEBSQL; |
| 290 } | 284 } |
| OLD | NEW |