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

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

Issue 115733007: Fix non-otr profile's file manager being launched in guest mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 11 matching lines...) Expand all
22 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" 22 #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
23 #include "chrome/browser/chromeos/file_manager/open_util.h" 23 #include "chrome/browser/chromeos/file_manager/open_util.h"
24 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 24 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
25 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 25 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
26 #include "chrome/browser/chromeos/login/screen_locker.h" 26 #include "chrome/browser/chromeos/login/screen_locker.h"
27 #include "chrome/browser/drive/drive_service_interface.h" 27 #include "chrome/browser/drive/drive_service_interface.h"
28 #include "chrome/browser/extensions/event_names.h" 28 #include "chrome/browser/extensions/event_names.h"
29 #include "chrome/browser/extensions/extension_service.h" 29 #include "chrome/browser/extensions/extension_service.h"
30 #include "chrome/browser/extensions/extension_system.h" 30 #include "chrome/browser/extensions/extension_system.h"
31 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/profiles/profile_manager.h"
32 #include "chrome/common/extensions/api/file_browser_private.h" 33 #include "chrome/common/extensions/api/file_browser_private.h"
33 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
34 #include "chromeos/login/login_state.h" 35 #include "chromeos/login/login_state.h"
35 #include "chromeos/network/network_handler.h" 36 #include "chromeos/network/network_handler.h"
36 #include "chromeos/network/network_state_handler.h" 37 #include "chromeos/network/network_state_handler.h"
37 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
38 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
39 #include "extensions/browser/event_router.h" 40 #include "extensions/browser/event_router.h"
40 #include "webkit/common/fileapi/file_system_types.h" 41 #include "webkit/common/fileapi/file_system_types.h"
41 #include "webkit/common/fileapi/file_system_util.h" 42 #include "webkit/common/fileapi/file_system_util.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 scoped_ptr<extensions::Event> event(new extensions::Event( 620 scoped_ptr<extensions::Event> event(new extensions::Event(
620 extensions::event_names::kOnDirectoryChanged, args.Pass())); 621 extensions::event_names::kOnDirectoryChanged, args.Pass()));
621 extensions::ExtensionSystem::Get(profile_)->event_router()-> 622 extensions::ExtensionSystem::Get(profile_)->event_router()->
622 DispatchEventToExtension(extension_id, event.Pass()); 623 DispatchEventToExtension(extension_id, event.Pass());
623 } 624 }
624 } 625 }
625 626
626 void EventRouter::ShowRemovableDeviceInFileManager( 627 void EventRouter::ShowRemovableDeviceInFileManager(
627 const base::FilePath& mount_path) { 628 const base::FilePath& mount_path) {
628 // Do not attempt to open File Manager while the login is in progress or 629 // Do not attempt to open File Manager while the login is in progress or
629 // the screen is locked. 630 // the screen is locked and make sure the file manager is opened only for the
631 // active user.
630 if (chromeos::LoginDisplayHostImpl::default_host() || 632 if (chromeos::LoginDisplayHostImpl::default_host() ||
631 chromeos::ScreenLocker::default_screen_locker()) 633 chromeos::ScreenLocker::default_screen_locker() ||
634 profile_ != ProfileManager::GetActiveUserProfile())
632 return; 635 return;
633 636
634 // According to DCF (Design rule of Camera File system) by JEITA / CP-3461 637 // According to DCF (Design rule of Camera File system) by JEITA / CP-3461
635 // cameras should have pictures located in the DCIM root directory. 638 // cameras should have pictures located in the DCIM root directory.
636 const base::FilePath dcim_path = mount_path.Append( 639 const base::FilePath dcim_path = mount_path.Append(
637 FILE_PATH_LITERAL("DCIM")); 640 FILE_PATH_LITERAL("DCIM"));
638 641
639 // If there is no DCIM folder or an external photo importer is not available, 642 // If there is no DCIM folder or an external photo importer is not available,
640 // then launch Files.app. 643 // then launch Files.app.
641 DirectoryExistsOnUIThread( 644 DirectoryExistsOnUIThread(
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 base::TimeDelta::FromSeconds(4)); 764 base::TimeDelta::FromSeconds(4));
762 } else { 765 } else {
763 notifications_->HideNotification(DesktopNotifications::FORMAT_START, 766 notifications_->HideNotification(DesktopNotifications::FORMAT_START,
764 device_path); 767 device_path);
765 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL, 768 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL,
766 device_path); 769 device_path);
767 } 770 }
768 } 771 }
769 772
770 } // namespace file_manager 773 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698