Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 406 BroadcastEvent(profile_, | 406 BroadcastEvent(profile_, |
| 407 extensions::events::FILE_MANAGER_PRIVATE_ON_APPS_UPDATED, | 407 extensions::events::FILE_MANAGER_PRIVATE_ON_APPS_UPDATED, |
| 408 file_manager_private::OnAppsUpdated::kEventName, | 408 file_manager_private::OnAppsUpdated::kEventName, |
| 409 file_manager_private::OnAppsUpdated::Create()); | 409 file_manager_private::OnAppsUpdated::Create()); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void EventRouter::Shutdown() { | 412 void EventRouter::Shutdown() { |
| 413 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 413 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 414 | 414 |
| 415 if (arc::ArcServiceManager::IsInitialized()) | 415 auto* intent_helper = |
|
Yusuke Sato
2017/01/11 23:12:37
kinaba: I've removed IsInitialized() from the mana
| |
| 416 arc::ArcServiceManager::Get()->RemoveObserver(this); | 416 arc::ArcIntentHelperBridge::Get(arc::ArcServiceManager::Get()); |
| 417 if (intent_helper) | |
| 418 intent_helper->RemoveObserver(this); | |
| 417 | 419 |
| 418 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 420 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
| 419 | 421 |
| 420 DLOG_IF(WARNING, !file_watchers_.empty()) | 422 DLOG_IF(WARNING, !file_watchers_.empty()) |
| 421 << "Not all file watchers are " | 423 << "Not all file watchers are " |
| 422 << "removed. This can happen when Files.app is open during shutdown."; | 424 << "removed. This can happen when Files.app is open during shutdown."; |
| 423 file_watchers_.clear(); | 425 file_watchers_.clear(); |
| 424 if (!profile_) { | 426 if (!profile_) { |
| 425 NOTREACHED(); | 427 NOTREACHED(); |
| 426 return; | 428 return; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 weak_factory_.GetWeakPtr()); | 501 weak_factory_.GetWeakPtr()); |
| 500 pref_change_registrar_->Add(drive::prefs::kDisableDriveOverCellular, | 502 pref_change_registrar_->Add(drive::prefs::kDisableDriveOverCellular, |
| 501 callback); | 503 callback); |
| 502 pref_change_registrar_->Add(drive::prefs::kDisableDriveHostedFiles, callback); | 504 pref_change_registrar_->Add(drive::prefs::kDisableDriveHostedFiles, callback); |
| 503 pref_change_registrar_->Add(drive::prefs::kDisableDrive, callback); | 505 pref_change_registrar_->Add(drive::prefs::kDisableDrive, callback); |
| 504 pref_change_registrar_->Add(prefs::kSearchSuggestEnabled, callback); | 506 pref_change_registrar_->Add(prefs::kSearchSuggestEnabled, callback); |
| 505 pref_change_registrar_->Add(prefs::kUse24HourClock, callback); | 507 pref_change_registrar_->Add(prefs::kUse24HourClock, callback); |
| 506 | 508 |
| 507 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); | 509 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); |
| 508 | 510 |
| 509 if (arc::ArcSessionManager::IsAllowedForProfile(profile_)) | 511 if (arc::ArcSessionManager::IsAllowedForProfile(profile_)) { |
| 510 arc::ArcServiceManager::Get()->AddObserver(this); | 512 auto* intent_helper = |
| 513 arc::ArcIntentHelperBridge::Get(arc::ArcServiceManager::Get()); | |
| 514 if (intent_helper) | |
| 515 intent_helper->AddObserver(this); | |
| 516 } | |
| 511 } | 517 } |
| 512 | 518 |
| 513 // File watch setup routines. | 519 // File watch setup routines. |
| 514 void EventRouter::AddFileWatch(const base::FilePath& local_path, | 520 void EventRouter::AddFileWatch(const base::FilePath& local_path, |
| 515 const base::FilePath& virtual_path, | 521 const base::FilePath& virtual_path, |
| 516 const std::string& extension_id, | 522 const std::string& extension_id, |
| 517 const BoolCallback& callback) { | 523 const BoolCallback& callback) { |
| 518 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 524 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 519 DCHECK(!callback.is_null()); | 525 DCHECK(!callback.is_null()); |
| 520 | 526 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( | 1006 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( |
| 1001 const DispatchDirectoryChangeEventImplCallback& callback) { | 1007 const DispatchDirectoryChangeEventImplCallback& callback) { |
| 1002 dispatch_directory_change_event_impl_ = callback; | 1008 dispatch_directory_change_event_impl_ = callback; |
| 1003 } | 1009 } |
| 1004 | 1010 |
| 1005 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { | 1011 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { |
| 1006 return weak_factory_.GetWeakPtr(); | 1012 return weak_factory_.GetWeakPtr(); |
| 1007 } | 1013 } |
| 1008 | 1014 |
| 1009 } // namespace file_manager | 1015 } // namespace file_manager |
| OLD | NEW |