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

Side by Side Diff: chrome/browser/extensions/api/cookies/cookies_api.cc

Issue 309533007: Refactor PermissionsData pt1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 // 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698