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 <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 136 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
137 dict->SetBoolean(keys::kRemovedKey, details->removed); | 137 dict->SetBoolean(keys::kRemovedKey, details->removed); |
138 | 138 |
139 cookies::Cookie cookie = cookies_helpers::CreateCookie( | 139 cookies::Cookie cookie = cookies_helpers::CreateCookie( |
140 *details->cookie, cookies_helpers::GetStoreIdFromProfile(profile)); | 140 *details->cookie, cookies_helpers::GetStoreIdFromProfile(profile)); |
141 dict->Set(keys::kCookieKey, cookie.ToValue()); | 141 dict->Set(keys::kCookieKey, cookie.ToValue()); |
142 | 142 |
143 // Map the internal cause to an external string. | 143 // Map the internal cause to an external string. |
144 std::string cause; | 144 std::string cause; |
145 switch (details->cause) { | 145 switch (details->cause) { |
146 case net::CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT: | 146 case net::CookieStore::CHANGE_COOKIE_INSERTED: |
147 case net::CookieStore::CHANGE_COOKIE_UNKNOWN_DELETION: | |
Devlin
2016/09/26 16:46:09
Is it accurate to lump these two in here? e.g. un
nharper
2016/09/26 21:09:10
I agree that UNKNOWN_DELETION doesn't belong here.
Devlin
2016/09/27 15:48:05
I think that all makes sense - unknown deletion wa
nharper
2016/09/27 17:43:48
Done.
| |
148 case net::CookieStore::CHANGE_COOKIE_EXPLICIT: | |
147 cause = keys::kExplicitChangeCause; | 149 cause = keys::kExplicitChangeCause; |
148 break; | 150 break; |
149 | 151 |
150 case net::CookieMonsterDelegate::CHANGE_COOKIE_OVERWRITE: | 152 case net::CookieStore::CHANGE_COOKIE_OVERWRITE: |
151 cause = keys::kOverwriteChangeCause; | 153 cause = keys::kOverwriteChangeCause; |
152 break; | 154 break; |
153 | 155 |
154 case net::CookieMonsterDelegate::CHANGE_COOKIE_EXPIRED: | 156 case net::CookieStore::CHANGE_COOKIE_EXPIRED: |
155 cause = keys::kExpiredChangeCause; | 157 cause = keys::kExpiredChangeCause; |
156 break; | 158 break; |
157 | 159 |
158 case net::CookieMonsterDelegate::CHANGE_COOKIE_EVICTED: | 160 case net::CookieStore::CHANGE_COOKIE_EVICTED: |
159 cause = keys::kEvictedChangeCause; | 161 cause = keys::kEvictedChangeCause; |
160 break; | 162 break; |
161 | 163 |
162 case net::CookieMonsterDelegate::CHANGE_COOKIE_EXPIRED_OVERWRITE: | 164 case net::CookieStore::CHANGE_COOKIE_EXPIRED_OVERWRITE: |
163 cause = keys::kExpiredOverwriteChangeCause; | 165 cause = keys::kExpiredOverwriteChangeCause; |
164 break; | 166 break; |
165 | 167 |
166 default: | 168 default: |
167 NOTREACHED(); | 169 NOTREACHED(); |
168 } | 170 } |
169 dict->SetString(keys::kCauseKey, cause); | 171 dict->SetString(keys::kCauseKey, cause); |
170 | 172 |
171 args->Append(std::move(dict)); | 173 args->Append(std::move(dict)); |
172 | 174 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { | 587 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { |
586 return g_factory.Pointer(); | 588 return g_factory.Pointer(); |
587 } | 589 } |
588 | 590 |
589 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { | 591 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { |
590 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); | 592 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
591 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 593 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
592 } | 594 } |
593 | 595 |
594 } // namespace extensions | 596 } // namespace extensions |
OLD | NEW |