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

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

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | Annotate | Revision Log
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 #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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_change_registrar.h" 10 #include "base/prefs/pref_change_registrar.h"
(...skipping 25 matching lines...) Expand all
36 #include "chromeos/network/network_handler.h" 36 #include "chromeos/network/network_handler.h"
37 #include "chromeos/network/network_state_handler.h" 37 #include "chromeos/network/network_state_handler.h"
38 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
40 #include "content/public/browser/render_process_host.h" 40 #include "content/public/browser/render_process_host.h"
41 #include "content/public/browser/storage_partition.h" 41 #include "content/public/browser/storage_partition.h"
42 #include "extensions/browser/event_router.h" 42 #include "extensions/browser/event_router.h"
43 #include "extensions/browser/extension_host.h" 43 #include "extensions/browser/extension_host.h"
44 #include "extensions/browser/extension_prefs.h" 44 #include "extensions/browser/extension_prefs.h"
45 #include "extensions/browser/extension_system.h" 45 #include "extensions/browser/extension_system.h"
46 #include "webkit/common/fileapi/file_system_types.h" 46 #include "storage/common/fileapi/file_system_types.h"
47 #include "webkit/common/fileapi/file_system_util.h" 47 #include "storage/common/fileapi/file_system_util.h"
48 48
49 using chromeos::disks::DiskMountManager; 49 using chromeos::disks::DiskMountManager;
50 using chromeos::NetworkHandler; 50 using chromeos::NetworkHandler;
51 using content::BrowserThread; 51 using content::BrowserThread;
52 using drive::DriveIntegrationService; 52 using drive::DriveIntegrationService;
53 using drive::DriveIntegrationServiceFactory; 53 using drive::DriveIntegrationServiceFactory;
54 using file_manager::util::EntryDefinition; 54 using file_manager::util::EntryDefinition;
55 using file_manager::util::FileDefinition; 55 using file_manager::util::FileDefinition;
56 56
57 namespace file_browser_private = extensions::api::file_browser_private; 57 namespace file_browser_private = extensions::api::file_browser_private;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 return file_browser_private::MOUNT_COMPLETED_STATUS_ERROR_AUTHENTICATION; 188 return file_browser_private::MOUNT_COMPLETED_STATUS_ERROR_AUTHENTICATION;
189 case chromeos::MOUNT_ERROR_PATH_UNMOUNTED: 189 case chromeos::MOUNT_ERROR_PATH_UNMOUNTED:
190 return file_browser_private::MOUNT_COMPLETED_STATUS_ERROR_PATH_UNMOUNTED; 190 return file_browser_private::MOUNT_COMPLETED_STATUS_ERROR_PATH_UNMOUNTED;
191 } 191 }
192 NOTREACHED(); 192 NOTREACHED();
193 return file_browser_private::MOUNT_COMPLETED_STATUS_NONE; 193 return file_browser_private::MOUNT_COMPLETED_STATUS_NONE;
194 } 194 }
195 195
196 file_browser_private::CopyProgressStatusType 196 file_browser_private::CopyProgressStatusType
197 CopyProgressTypeToCopyProgressStatusType( 197 CopyProgressTypeToCopyProgressStatusType(
198 fileapi::FileSystemOperation::CopyProgressType type) { 198 storage::FileSystemOperation::CopyProgressType type) {
199 switch (type) { 199 switch (type) {
200 case fileapi::FileSystemOperation::BEGIN_COPY_ENTRY: 200 case storage::FileSystemOperation::BEGIN_COPY_ENTRY:
201 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_BEGIN_COPY_ENTRY; 201 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_BEGIN_COPY_ENTRY;
202 case fileapi::FileSystemOperation::END_COPY_ENTRY: 202 case storage::FileSystemOperation::END_COPY_ENTRY:
203 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_END_COPY_ENTRY; 203 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_END_COPY_ENTRY;
204 case fileapi::FileSystemOperation::PROGRESS: 204 case storage::FileSystemOperation::PROGRESS:
205 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_PROGRESS; 205 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_PROGRESS;
206 } 206 }
207 NOTREACHED(); 207 NOTREACHED();
208 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_NONE; 208 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_NONE;
209 } 209 }
210 210
211 file_browser_private::ChangeType ConvertChangeTypeFromDriveToApi( 211 file_browser_private::ChangeType ConvertChangeTypeFromDriveToApi(
212 drive::FileChange::ChangeType type) { 212 drive::FileChange::ChangeType type) {
213 switch (type) { 213 switch (type) {
214 case drive::FileChange::ADD_OR_UPDATE: 214 case drive::FileChange::ADD_OR_UPDATE:
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } 520 }
521 521
522 BroadcastEvent( 522 BroadcastEvent(
523 profile_, 523 profile_,
524 file_browser_private::OnCopyProgress::kEventName, 524 file_browser_private::OnCopyProgress::kEventName,
525 file_browser_private::OnCopyProgress::Create(copy_id, status)); 525 file_browser_private::OnCopyProgress::Create(copy_id, status));
526 } 526 }
527 527
528 void EventRouter::OnCopyProgress( 528 void EventRouter::OnCopyProgress(
529 int copy_id, 529 int copy_id,
530 fileapi::FileSystemOperation::CopyProgressType type, 530 storage::FileSystemOperation::CopyProgressType type,
531 const GURL& source_url, 531 const GURL& source_url,
532 const GURL& destination_url, 532 const GURL& destination_url,
533 int64 size) { 533 int64 size) {
534 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 534 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
535 535
536 file_browser_private::CopyProgressStatus status; 536 file_browser_private::CopyProgressStatus status;
537 status.type = CopyProgressTypeToCopyProgressStatusType(type); 537 status.type = CopyProgressTypeToCopyProgressStatusType(type);
538 status.source_url.reset(new std::string(source_url.spec())); 538 status.source_url.reset(new std::string(source_url.spec()));
539 if (type == fileapi::FileSystemOperation::END_COPY_ENTRY) 539 if (type == storage::FileSystemOperation::END_COPY_ENTRY)
540 status.destination_url.reset(new std::string(destination_url.spec())); 540 status.destination_url.reset(new std::string(destination_url.spec()));
541 if (type == fileapi::FileSystemOperation::PROGRESS) 541 if (type == storage::FileSystemOperation::PROGRESS)
542 status.size.reset(new double(size)); 542 status.size.reset(new double(size));
543 543
544 // Should not skip events other than TYPE_PROGRESS. 544 // Should not skip events other than TYPE_PROGRESS.
545 const bool always = 545 const bool always =
546 status.type != file_browser_private::COPY_PROGRESS_STATUS_TYPE_PROGRESS; 546 status.type != file_browser_private::COPY_PROGRESS_STATUS_TYPE_PROGRESS;
547 if (!ShouldSendProgressEvent(always, &last_copy_progress_event_)) 547 if (!ShouldSendProgressEvent(always, &last_copy_progress_event_))
548 return; 548 return;
549 549
550 BroadcastEvent( 550 BroadcastEvent(
551 profile_, 551 profile_,
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 } 977 }
978 } 978 }
979 979
980 void EventRouter::OnOwnerEntryChanged(aura::Window* window) { 980 void EventRouter::OnOwnerEntryChanged(aura::Window* window) {
981 BroadcastEvent(profile_, 981 BroadcastEvent(profile_,
982 file_browser_private::OnDesktopChanged::kEventName, 982 file_browser_private::OnDesktopChanged::kEventName,
983 file_browser_private::OnDesktopChanged::Create()); 983 file_browser_private::OnDesktopChanged::Create());
984 } 984 }
985 985
986 } // namespace file_manager 986 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698