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

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

Issue 1829783002: [Extensions] Convert APIs to use movable types [5] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/private_api_drive.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 } 845 }
846 846
847 file_manager_private::FileWatchEvent event; 847 file_manager_private::FileWatchEvent event;
848 event.event_type = watcher_error 848 event.event_type = watcher_error
849 ? file_manager_private::FILE_WATCH_EVENT_TYPE_ERROR 849 ? file_manager_private::FILE_WATCH_EVENT_TYPE_ERROR
850 : file_manager_private::FILE_WATCH_EVENT_TYPE_CHANGED; 850 : file_manager_private::FILE_WATCH_EVENT_TYPE_CHANGED;
851 851
852 // Detailed information is available. 852 // Detailed information is available.
853 if (list.get()) { 853 if (list.get()) {
854 event.changed_files.reset( 854 event.changed_files.reset(
855 new std::vector<linked_ptr<file_manager_private::FileChange> >); 855 new std::vector<file_manager_private::FileChange>());
856 856
857 if (list->map().empty()) 857 if (list->map().empty())
858 return; 858 return;
859 859
860 for (drive::FileChange::Map::const_iterator it = list->map().begin(); 860 for (drive::FileChange::Map::const_iterator it = list->map().begin();
861 it != list->map().end(); 861 it != list->map().end();
862 it++) { 862 it++) {
863 linked_ptr<file_manager_private::FileChange> change_list( 863 file_manager_private::FileChange change_list;
864 new file_manager_private::FileChange);
865 864
866 GURL url = util::ConvertDrivePathToFileSystemUrl( 865 GURL url = util::ConvertDrivePathToFileSystemUrl(
867 profile_, it->first, *extension_id); 866 profile_, it->first, *extension_id);
868 change_list->url = url.spec(); 867 change_list.url = url.spec();
869 868
870 for (drive::FileChange::ChangeList::List::const_iterator change = 869 for (drive::FileChange::ChangeList::List::const_iterator change =
871 it->second.list().begin(); 870 it->second.list().begin();
872 change != it->second.list().end(); 871 change != it->second.list().end();
873 change++) { 872 change++) {
874 change_list->changes.push_back( 873 change_list.changes.push_back(
875 ConvertChangeTypeFromDriveToApi(change->change())); 874 ConvertChangeTypeFromDriveToApi(change->change()));
876 } 875 }
877 876
878 event.changed_files->push_back(change_list); 877 event.changed_files->push_back(std::move(change_list));
879 } 878 }
880 } 879 }
881 880
882 event.entry.additional_properties.SetString( 881 event.entry.additional_properties.SetString(
883 "fileSystemName", entry_definition.file_system_name); 882 "fileSystemName", entry_definition.file_system_name);
884 event.entry.additional_properties.SetString( 883 event.entry.additional_properties.SetString(
885 "fileSystemRoot", entry_definition.file_system_root_url); 884 "fileSystemRoot", entry_definition.file_system_root_url);
886 event.entry.additional_properties.SetString( 885 event.entry.additional_properties.SetString(
887 "fileFullPath", "/" + entry_definition.full_path.value()); 886 "fileFullPath", "/" + entry_definition.full_path.value());
888 event.entry.additional_properties.SetBoolean("fileIsDirectory", 887 event.entry.additional_properties.SetBoolean("fileIsDirectory",
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( 975 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting(
977 const DispatchDirectoryChangeEventImplCallback& callback) { 976 const DispatchDirectoryChangeEventImplCallback& callback) {
978 dispatch_directory_change_event_impl_ = callback; 977 dispatch_directory_change_event_impl_ = callback;
979 } 978 }
980 979
981 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { 980 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() {
982 return weak_factory_.GetWeakPtr(); 981 return weak_factory_.GetWeakPtr();
983 } 982 }
984 983
985 } // namespace file_manager 984 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/private_api_drive.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698