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

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

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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 <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
13 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
14 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.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"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 default: 172 default:
172 NOTREACHED(); 173 NOTREACHED();
173 } 174 }
174 dict->SetString(keys::kCauseKey, cause); 175 dict->SetString(keys::kCauseKey, cause);
175 176
176 args->Append(dict); 177 args->Append(dict);
177 178
178 GURL cookie_domain = 179 GURL cookie_domain =
179 cookies_helpers::GetURLFromCanonicalCookie(*details->cookie); 180 cookies_helpers::GetURLFromCanonicalCookie(*details->cookie);
180 DispatchEvent(profile, events::COOKIES_ON_CHANGED, 181 DispatchEvent(profile, events::COOKIES_ON_CHANGED,
181 cookies::OnChanged::kEventName, args.Pass(), cookie_domain); 182 cookies::OnChanged::kEventName, std::move(args), cookie_domain);
182 } 183 }
183 184
184 void CookiesEventRouter::DispatchEvent(content::BrowserContext* context, 185 void CookiesEventRouter::DispatchEvent(content::BrowserContext* context,
185 events::HistogramValue histogram_value, 186 events::HistogramValue histogram_value,
186 const std::string& event_name, 187 const std::string& event_name,
187 scoped_ptr<base::ListValue> event_args, 188 scoped_ptr<base::ListValue> event_args,
188 GURL& cookie_domain) { 189 GURL& cookie_domain) {
189 EventRouter* router = context ? EventRouter::Get(context) : NULL; 190 EventRouter* router = context ? EventRouter::Get(context) : NULL;
190 if (!router) 191 if (!router)
191 return; 192 return;
192 scoped_ptr<Event> event( 193 scoped_ptr<Event> event(
193 new Event(histogram_value, event_name, event_args.Pass())); 194 new Event(histogram_value, event_name, std::move(event_args)));
194 event->restrict_to_browser_context = context; 195 event->restrict_to_browser_context = context;
195 event->event_url = cookie_domain; 196 event->event_url = cookie_domain;
196 router->BroadcastEvent(event.Pass()); 197 router->BroadcastEvent(std::move(event));
197 } 198 }
198 199
199 CookiesGetFunction::CookiesGetFunction() { 200 CookiesGetFunction::CookiesGetFunction() {
200 } 201 }
201 202
202 CookiesGetFunction::~CookiesGetFunction() { 203 CookiesGetFunction::~CookiesGetFunction() {
203 } 204 }
204 205
205 bool CookiesGetFunction::RunAsync() { 206 bool CookiesGetFunction::RunAsync() {
206 parsed_args_ = Get::Params::Create(*args_); 207 parsed_args_ = Get::Params::Create(*args_);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { 583 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() {
583 return g_factory.Pointer(); 584 return g_factory.Pointer();
584 } 585 }
585 586
586 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { 587 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) {
587 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); 588 cookies_event_router_.reset(new CookiesEventRouter(browser_context_));
588 EventRouter::Get(browser_context_)->UnregisterObserver(this); 589 EventRouter::Get(browser_context_)->UnregisterObserver(this);
589 } 590 }
590 591
591 } // namespace extensions 592 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698