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

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

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Created 3 years, 8 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
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 common functionality for the Chrome Extensions Cookies API. 5 // Implements common functionality for the Chrome Extensions Cookies API.
6 6
7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" 7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <utility>
12 #include <vector> 11 #include <vector>
13 12
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
17 #include "base/values.h" 16 #include "base/values.h"
18 #include "chrome/browser/extensions/api/cookies/cookies_api_constants.h" 17 #include "chrome/browser/extensions/api/cookies/cookies_api_constants.h"
19 #include "chrome/browser/extensions/extension_tab_util.h" 18 #include "chrome/browser/extensions/extension_tab_util.h"
20 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 cookie.session = !canonical_cookie.IsPersistent(); 96 cookie.session = !canonical_cookie.IsPersistent();
98 if (canonical_cookie.IsPersistent()) { 97 if (canonical_cookie.IsPersistent()) {
99 cookie.expiration_date.reset( 98 cookie.expiration_date.reset(
100 new double(canonical_cookie.ExpiryDate().ToDoubleT())); 99 new double(canonical_cookie.ExpiryDate().ToDoubleT()));
101 } 100 }
102 cookie.store_id = store_id; 101 cookie.store_id = store_id;
103 102
104 return cookie; 103 return cookie;
105 } 104 }
106 105
107 CookieStore CreateCookieStore(Profile* profile, 106 CookieStore CreateCookieStore(Profile* profile, base::ListValue* tab_ids) {
108 std::unique_ptr<base::ListValue> tab_ids) {
109 DCHECK(profile); 107 DCHECK(profile);
110 DCHECK(tab_ids); 108 DCHECK(tab_ids);
111 base::DictionaryValue dict; 109 base::DictionaryValue dict;
112 dict.SetString(keys::kIdKey, GetStoreIdFromProfile(profile)); 110 dict.SetString(keys::kIdKey, GetStoreIdFromProfile(profile));
113 dict.Set(keys::kTabIdsKey, std::move(tab_ids)); 111 dict.Set(keys::kTabIdsKey, tab_ids);
114 112
115 CookieStore cookie_store; 113 CookieStore cookie_store;
116 bool rv = CookieStore::Populate(dict, &cookie_store); 114 bool rv = CookieStore::Populate(dict, &cookie_store);
117 CHECK(rv); 115 CHECK(rv);
118 return cookie_store; 116 return cookie_store;
119 } 117 }
120 118
121 void GetCookieListFromStore( 119 void GetCookieListFromStore(
122 net::CookieStore* cookie_store, 120 net::CookieStore* cookie_store,
123 const GURL& url, 121 const GURL& url,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (sub_domain == *details_->domain) 212 if (sub_domain == *details_->domain)
215 return true; 213 return true;
216 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. 214 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot.
217 sub_domain.erase(0, next_dot); 215 sub_domain.erase(0, next_dot);
218 } 216 }
219 return false; 217 return false;
220 } 218 }
221 219
222 } // namespace cookies_helpers 220 } // namespace cookies_helpers
223 } // namespace extensions 221 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/cookies/cookies_helpers.h ('k') | chrome/browser/extensions/api/cookies/cookies_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698