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

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

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase 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 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/memory/ptr_util.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/extensions/api/cookies/cookies_api_constants.h" 20 #include "chrome/browser/extensions/api/cookies/cookies_api_constants.h"
20 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" 21 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h"
21 #include "chrome/browser/extensions/chrome_extension_function_details.h" 22 #include "chrome/browser/extensions/chrome_extension_function_details.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_list.h" 25 #include "chrome/browser/ui/browser_list.h"
25 #include "chrome/common/extensions/api/cookies.h" 26 #include "chrome/common/extensions/api/cookies.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (cookie.Name() == parsed_args_->details.name) { 252 if (cookie.Name() == parsed_args_->details.name) {
252 cookies::Cookie api_cookie = cookies_helpers::CreateCookie( 253 cookies::Cookie api_cookie = cookies_helpers::CreateCookie(
253 cookie, *parsed_args_->details.store_id); 254 cookie, *parsed_args_->details.store_id);
254 results_ = Get::Results::Create(api_cookie); 255 results_ = Get::Results::Create(api_cookie);
255 break; 256 break;
256 } 257 }
257 } 258 }
258 259
259 // The cookie doesn't exist; return null. 260 // The cookie doesn't exist; return null.
260 if (!results_) 261 if (!results_)
261 SetResult(base::Value::CreateNullValue()); 262 SetResult(base::MakeUnique<base::Value>());
262 263
263 bool rv = BrowserThread::PostTask( 264 bool rv = BrowserThread::PostTask(
264 BrowserThread::UI, FROM_HERE, 265 BrowserThread::UI, FROM_HERE,
265 base::Bind(&CookiesGetFunction::RespondOnUIThread, this)); 266 base::Bind(&CookiesGetFunction::RespondOnUIThread, this));
266 DCHECK(rv); 267 DCHECK(rv);
267 } 268 }
268 269
269 void CookiesGetFunction::RespondOnUIThread() { 270 void CookiesGetFunction::RespondOnUIThread() {
270 DCHECK_CURRENTLY_ON(BrowserThread::UI); 271 DCHECK_CURRENTLY_ON(BrowserThread::UI);
271 SendResponse(true); 272 SendResponse(true);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { 588 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() {
588 return g_factory.Pointer(); 589 return g_factory.Pointer();
589 } 590 }
590 591
591 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { 592 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) {
592 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); 593 cookies_event_router_.reset(new CookiesEventRouter(browser_context_));
593 EventRouter::Get(browser_context_)->UnregisterObserver(this); 594 EventRouter::Get(browser_context_)->UnregisterObserver(this);
594 } 595 }
595 596
596 } // namespace extensions 597 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698