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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/event_router.cc

Issue 2257103002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/extensions/file_manager/event_router.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 return false; 99 return false;
100 } 100 }
101 101
102 // Sends an event named |event_name| with arguments |event_args| to extensions. 102 // Sends an event named |event_name| with arguments |event_args| to extensions.
103 void BroadcastEvent(Profile* profile, 103 void BroadcastEvent(Profile* profile,
104 extensions::events::HistogramValue histogram_value, 104 extensions::events::HistogramValue histogram_value,
105 const std::string& event_name, 105 const std::string& event_name,
106 std::unique_ptr<base::ListValue> event_args) { 106 std::unique_ptr<base::ListValue> event_args) {
107 extensions::EventRouter::Get(profile)->BroadcastEvent( 107 extensions::EventRouter::Get(profile)->BroadcastEvent(
108 base::WrapUnique(new extensions::Event(histogram_value, event_name, 108 base::MakeUnique<extensions::Event>(histogram_value, event_name,
109 std::move(event_args)))); 109 std::move(event_args)));
110 } 110 }
111 111
112 // Sends an event named |event_name| with arguments |event_args| to an extension 112 // Sends an event named |event_name| with arguments |event_args| to an extension
113 // of |extention_id|. 113 // of |extention_id|.
114 void DispatchEventToExtension( 114 void DispatchEventToExtension(
115 Profile* profile, 115 Profile* profile,
116 const std::string& extension_id, 116 const std::string& extension_id,
117 extensions::events::HistogramValue histogram_value, 117 extensions::events::HistogramValue histogram_value,
118 const std::string& event_name, 118 const std::string& event_name,
119 std::unique_ptr<base::ListValue> event_args) { 119 std::unique_ptr<base::ListValue> event_args) {
120 extensions::EventRouter::Get(profile)->DispatchEventToExtension( 120 extensions::EventRouter::Get(profile)->DispatchEventToExtension(
121 extension_id, base::WrapUnique(new extensions::Event( 121 extension_id, base::MakeUnique<extensions::Event>(
122 histogram_value, event_name, std::move(event_args)))); 122 histogram_value, event_name, std::move(event_args)));
123 } 123 }
124 124
125 file_manager_private::MountCompletedStatus 125 file_manager_private::MountCompletedStatus
126 MountErrorToMountCompletedStatus(chromeos::MountError error) { 126 MountErrorToMountCompletedStatus(chromeos::MountError error) {
127 switch (error) { 127 switch (error) {
128 case chromeos::MOUNT_ERROR_NONE: 128 case chromeos::MOUNT_ERROR_NONE:
129 return file_manager_private::MOUNT_COMPLETED_STATUS_SUCCESS; 129 return file_manager_private::MOUNT_COMPLETED_STATUS_SUCCESS;
130 case chromeos::MOUNT_ERROR_UNKNOWN: 130 case chromeos::MOUNT_ERROR_UNKNOWN:
131 return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN; 131 return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN;
132 case chromeos::MOUNT_ERROR_INTERNAL: 132 case chromeos::MOUNT_ERROR_INTERNAL:
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( 977 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting(
978 const DispatchDirectoryChangeEventImplCallback& callback) { 978 const DispatchDirectoryChangeEventImplCallback& callback) {
979 dispatch_directory_change_event_impl_ = callback; 979 dispatch_directory_change_event_impl_ = callback;
980 } 980 }
981 981
982 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { 982 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() {
983 return weak_factory_.GetWeakPtr(); 983 return weak_factory_.GetWeakPtr();
984 } 984 }
985 985
986 } // namespace file_manager 986 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698