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

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

Issue 2581953002: Introduce ArcServiceManager::OnShutdown(). (Closed)
Patch Set: Address comments. Created 4 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
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 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 dispatch_directory_change_event_impl_( 394 dispatch_directory_change_event_impl_(
395 base::Bind(&EventRouter::DispatchDirectoryChangeEventImpl, 395 base::Bind(&EventRouter::DispatchDirectoryChangeEventImpl,
396 base::Unretained(this))), 396 base::Unretained(this))),
397 weak_factory_(this) { 397 weak_factory_(this) {
398 DCHECK_CURRENTLY_ON(BrowserThread::UI); 398 DCHECK_CURRENTLY_ON(BrowserThread::UI);
399 ObserveEvents(); 399 ObserveEvents();
400 } 400 }
401 401
402 EventRouter::~EventRouter() = default; 402 EventRouter::~EventRouter() = default;
403 403
404 void EventRouter::OnArcShutdown() {
405 DCHECK_CURRENTLY_ON(BrowserThread::UI);
406 arc::ArcServiceManager::Get()->RemoveObserver(this);
407 }
408
404 void EventRouter::OnIntentFiltersUpdated() { 409 void EventRouter::OnIntentFiltersUpdated() {
405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 410 DCHECK_CURRENTLY_ON(BrowserThread::UI);
406 BroadcastEvent(profile_, 411 BroadcastEvent(profile_,
407 extensions::events::FILE_MANAGER_PRIVATE_ON_APPS_UPDATED, 412 extensions::events::FILE_MANAGER_PRIVATE_ON_APPS_UPDATED,
408 file_manager_private::OnAppsUpdated::kEventName, 413 file_manager_private::OnAppsUpdated::kEventName,
409 file_manager_private::OnAppsUpdated::Create()); 414 file_manager_private::OnAppsUpdated::Create());
410 } 415 }
411 416
412 void EventRouter::Shutdown() { 417 void EventRouter::Shutdown() {
413 DCHECK_CURRENTLY_ON(BrowserThread::UI); 418 DCHECK_CURRENTLY_ON(BrowserThread::UI);
414 419
415 if (arc::ArcServiceManager::IsInitialized())
416 arc::ArcServiceManager::Get()->RemoveObserver(this);
417
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;
427 } 429 }
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( 1002 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting(
1001 const DispatchDirectoryChangeEventImplCallback& callback) { 1003 const DispatchDirectoryChangeEventImplCallback& callback) {
1002 dispatch_directory_change_event_impl_ = callback; 1004 dispatch_directory_change_event_impl_ = callback;
1003 } 1005 }
1004 1006
1005 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { 1007 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() {
1006 return weak_factory_.GetWeakPtr(); 1008 return weak_factory_.GetWeakPtr();
1007 } 1009 }
1008 1010
1009 } // namespace file_manager 1011 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/event_router.h ('k') | components/arc/arc_service_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698