| 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 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 5 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/content_settings/cookie_settings.h" | 11 #include "chrome/browser/content_settings/cookie_settings.h" |
| 12 #include "chrome/browser/intents/web_intents_util.h" | 12 #include "chrome/browser/intents/web_intents_util.h" |
| 13 #include "chrome/common/content_settings.h" | 13 #include "chrome/common/content_settings.h" |
| 14 #include "chrome/common/content_settings_types.h" | 14 #include "chrome/common/content_settings_types.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/extensions/web_intents_handler.h" |
| 16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 18 #include "extensions/common/constants.h" | 19 #include "extensions/common/constants.h" |
| 19 #include "webkit/glue/web_intent_service_data.h" | 20 #include "webkit/glue/web_intent_service_data.h" |
| 20 | 21 |
| 21 using content::BrowserThread; | 22 using content::BrowserThread; |
| 22 using extensions::APIPermission; | 23 using extensions::APIPermission; |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // Does the specified extension support the passed Web Intent, |action|? | 27 // Does the specified extension support the passed Web Intent, |action|? |
| 27 bool ExtensionSupportsIntentAction( | 28 bool ExtensionSupportsIntentAction( |
| 28 const extensions::Extension* extension, | 29 const extensions::Extension* extension, |
| 29 const std::string& action) { | 30 const std::string& action) { |
| 30 for (std::vector<webkit_glue::WebIntentServiceData>::const_iterator i = | 31 for (std::vector<webkit_glue::WebIntentServiceData>::const_iterator i = |
| 31 extension->intents_services().begin(); | 32 extensions::WebIntentsInfo::GetIntentsServices(extension).begin(); |
| 32 i != extension->intents_services().end(); ++i) { | 33 i != extensions::WebIntentsInfo::GetIntentsServices(extension).end(); |
| 34 ++i) { |
| 33 if (UTF16ToUTF8(i->action) == action) | 35 if (UTF16ToUTF8(i->action) == action) |
| 34 return true; | 36 return true; |
| 35 } | 37 } |
| 36 return false; | 38 return false; |
| 37 } | 39 } |
| 38 | 40 |
| 39 } // namespace | 41 } // namespace |
| 40 | 42 |
| 41 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( | 43 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( |
| 42 CookieSettings* cookie_settings) | 44 CookieSettings* cookie_settings) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 233 |
| 232 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { | 234 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { |
| 233 ClearCache(); | 235 ClearCache(); |
| 234 extensions_.Clear(); | 236 extensions_.Clear(); |
| 235 } | 237 } |
| 236 | 238 |
| 237 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { | 239 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { |
| 238 STLDeleteValues(&cached_results_); | 240 STLDeleteValues(&cached_results_); |
| 239 cached_results_.clear(); | 241 cached_results_.clear(); |
| 240 } | 242 } |
| OLD | NEW |