| 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 // Implements the Chrome Extensions Cookies API. | 5 // Implements the Chrome Extensions Cookies API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/cookies/cookies_api.h" | 7 #include "chrome/browser/extensions/api/cookies/cookies_api.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 GURL* url, | 55 GURL* url, |
| 56 bool check_host_permissions) { | 56 bool check_host_permissions) { |
| 57 *url = GURL(url_string); | 57 *url = GURL(url_string); |
| 58 if (!url->is_valid()) { | 58 if (!url->is_valid()) { |
| 59 function->SetError( | 59 function->SetError( |
| 60 ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string)); | 60 ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string)); |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 // Check against host permissions if needed. | 63 // Check against host permissions if needed. |
| 64 if (check_host_permissions && | 64 if (check_host_permissions && |
| 65 !PermissionsData::ForExtension(function->GetExtension()) | 65 !function->GetExtension()->permissions_data()->HasHostPermission(*url)) { |
| 66 ->HasHostPermission(*url)) { | |
| 67 function->SetError(ErrorUtils::FormatErrorMessage( | 66 function->SetError(ErrorUtils::FormatErrorMessage( |
| 68 keys::kNoHostPermissionsError, url->spec())); | 67 keys::kNoHostPermissionsError, url->spec())); |
| 69 return false; | 68 return false; |
| 70 } | 69 } |
| 71 return true; | 70 return true; |
| 72 } | 71 } |
| 73 | 72 |
| 74 bool ParseStoreContext(ChromeAsyncExtensionFunction* function, | 73 bool ParseStoreContext(ChromeAsyncExtensionFunction* function, |
| 75 std::string* store_id, | 74 std::string* store_id, |
| 76 net::URLRequestContextGetter** context) { | 75 net::URLRequestContextGetter** context) { |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 return g_factory.Pointer(); | 580 return g_factory.Pointer(); |
| 582 } | 581 } |
| 583 | 582 |
| 584 void CookiesAPI::OnListenerAdded( | 583 void CookiesAPI::OnListenerAdded( |
| 585 const extensions::EventListenerInfo& details) { | 584 const extensions::EventListenerInfo& details) { |
| 586 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); | 585 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
| 587 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 586 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 588 } | 587 } |
| 589 | 588 |
| 590 } // namespace extensions | 589 } // namespace extensions |
| OLD | NEW |