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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/operation.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h" 10 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h"
10 #include "extensions/browser/event_router.h" 11 #include "extensions/browser/event_router.h"
11 12
12 namespace chromeos { 13 namespace chromeos {
13 namespace file_system_provider { 14 namespace file_system_provider {
14 namespace operations { 15 namespace operations {
15 namespace { 16 namespace {
16 17
17 // Default implementation for dispatching an event. Can be replaced for unit 18 // Default implementation for dispatching an event. Can be replaced for unit
18 // tests by Operation::SetDispatchEventImplForTest(). 19 // tests by Operation::SetDispatchEventImplForTest().
19 bool DispatchEventImpl(extensions::EventRouter* event_router, 20 bool DispatchEventImpl(extensions::EventRouter* event_router,
20 const std::string& extension_id, 21 const std::string& extension_id,
21 scoped_ptr<extensions::Event> event) { 22 std::unique_ptr<extensions::Event> event) {
22 if (!event_router->ExtensionHasEventListener(extension_id, event->event_name)) 23 if (!event_router->ExtensionHasEventListener(extension_id, event->event_name))
23 return false; 24 return false;
24 25
25 event_router->DispatchEventToExtension(extension_id, std::move(event)); 26 event_router->DispatchEventToExtension(extension_id, std::move(event));
26 return true; 27 return true;
27 } 28 }
28 29
29 } // namespace 30 } // namespace
30 31
31 Operation::Operation(extensions::EventRouter* event_router, 32 Operation::Operation(extensions::EventRouter* event_router,
32 const ProvidedFileSystemInfo& file_system_info) 33 const ProvidedFileSystemInfo& file_system_info)
33 : file_system_info_(file_system_info), 34 : file_system_info_(file_system_info),
34 dispatch_event_impl_(base::Bind(&DispatchEventImpl, 35 dispatch_event_impl_(base::Bind(&DispatchEventImpl,
35 event_router, 36 event_router,
36 file_system_info_.extension_id())) { 37 file_system_info_.extension_id())) {
37 } 38 }
38 39
39 Operation::~Operation() { 40 Operation::~Operation() {
40 } 41 }
41 42
42 void Operation::SetDispatchEventImplForTesting( 43 void Operation::SetDispatchEventImplForTesting(
43 const DispatchEventImplCallback& callback) { 44 const DispatchEventImplCallback& callback) {
44 dispatch_event_impl_ = callback; 45 dispatch_event_impl_ = callback;
45 } 46 }
46 47
47 bool Operation::SendEvent(int request_id, 48 bool Operation::SendEvent(int request_id,
48 extensions::events::HistogramValue histogram_value, 49 extensions::events::HistogramValue histogram_value,
49 const std::string& event_name, 50 const std::string& event_name,
50 scoped_ptr<base::ListValue> event_args) { 51 std::unique_ptr<base::ListValue> event_args) {
51 return dispatch_event_impl_.Run(make_scoped_ptr(new extensions::Event( 52 return dispatch_event_impl_.Run(base::WrapUnique(new extensions::Event(
52 histogram_value, event_name, std::move(event_args)))); 53 histogram_value, event_name, std::move(event_args))));
53 } 54 }
54 55
55 } // namespace operations 56 } // namespace operations
56 } // namespace file_system_provider 57 } // namespace file_system_provider
57 } // namespace chromeos 58 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698