| OLD | NEW |
| 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_browser_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/prefs/public/pref_change_registrar.h" | 10 #include "base/prefs/public/pref_change_registrar.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 552 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 553 extensions::event_names::kOnFileBrowserDiskChanged, args.Pass(), NULL, | 553 extensions::event_names::kOnFileBrowserDiskChanged, args.Pass(), NULL, |
| 554 GURL()); | 554 GURL()); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void FileBrowserEventRouter::DispatchMountCompletedEvent( | 557 void FileBrowserEventRouter::DispatchMountCompletedEvent( |
| 558 DiskMountManager::MountEvent event, | 558 DiskMountManager::MountEvent event, |
| 559 chromeos::MountError error_code, | 559 chromeos::MountError error_code, |
| 560 const DiskMountManager::MountPointInfo& mount_info) { | 560 const DiskMountManager::MountPointInfo& mount_info) { |
| 561 if (!profile_ || mount_info.mount_type == chromeos::MOUNT_TYPE_INVALID) { | 561 // profile_ is NULL if ShutdownOnUIThread() is called earlier. This can |
| 562 // happen at shutdown. |
| 563 if (!profile_) |
| 564 return; |
| 565 |
| 566 if (mount_info.mount_type == chromeos::MOUNT_TYPE_INVALID) { |
| 562 NOTREACHED(); | 567 NOTREACHED(); |
| 563 return; | 568 return; |
| 564 } | 569 } |
| 565 | 570 |
| 566 scoped_ptr<ListValue> args(new ListValue()); | 571 scoped_ptr<ListValue> args(new ListValue()); |
| 567 DictionaryValue* mount_info_value = new DictionaryValue(); | 572 DictionaryValue* mount_info_value = new DictionaryValue(); |
| 568 args->Append(mount_info_value); | 573 args->Append(mount_info_value); |
| 569 mount_info_value->SetString("eventType", | 574 mount_info_value->SetString("eventType", |
| 570 event == DiskMountManager::MOUNTING ? "mount" : "unmount"); | 575 event == DiskMountManager::MOUNTING ? "mount" : "unmount"); |
| 571 mount_info_value->SetString("status", MountErrorToString(error_code)); | 576 mount_info_value->SetString("status", MountErrorToString(error_code)); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 return scoped_refptr<RefcountedProfileKeyedService>( | 880 return scoped_refptr<RefcountedProfileKeyedService>( |
| 876 new FileBrowserEventRouter(profile)); | 881 new FileBrowserEventRouter(profile)); |
| 877 } | 882 } |
| 878 | 883 |
| 879 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() const { | 884 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() const { |
| 880 // Explicitly and always allow this router in guest login mode. see | 885 // Explicitly and always allow this router in guest login mode. see |
| 881 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 886 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
| 882 // for the details. | 887 // for the details. |
| 883 return true; | 888 return true; |
| 884 } | 889 } |
| OLD | NEW |