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::HasHostPermission(function->GetExtension(), *url)) { | 65 !PermissionsData::ForExtension(function->GetExtension()) |
| 66 ->HasHostPermission(*url)) { |
66 function->SetError(ErrorUtils::FormatErrorMessage( | 67 function->SetError(ErrorUtils::FormatErrorMessage( |
67 keys::kNoHostPermissionsError, url->spec())); | 68 keys::kNoHostPermissionsError, url->spec())); |
68 return false; | 69 return false; |
69 } | 70 } |
70 return true; | 71 return true; |
71 } | 72 } |
72 | 73 |
73 bool ParseStoreContext(ChromeAsyncExtensionFunction* function, | 74 bool ParseStoreContext(ChromeAsyncExtensionFunction* function, |
74 std::string* store_id, | 75 std::string* store_id, |
75 net::URLRequestContextGetter** context) { | 76 net::URLRequestContextGetter** context) { |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 return g_factory.Pointer(); | 581 return g_factory.Pointer(); |
581 } | 582 } |
582 | 583 |
583 void CookiesAPI::OnListenerAdded( | 584 void CookiesAPI::OnListenerAdded( |
584 const extensions::EventListenerInfo& details) { | 585 const extensions::EventListenerInfo& details) { |
585 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); | 586 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
586 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 587 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
587 } | 588 } |
588 | 589 |
589 } // namespace extensions | 590 } // namespace extensions |
OLD | NEW |