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

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

Issue 2487623002: Notify Files App when ARC++ app is installed/removed (Closed)
Patch Set: Bug fix: I forgot to add intent_helper to arc_service_manager. 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 <utility> 9 #include <utility>
10 10
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 device_event_router_(new DeviceEventRouterImpl(profile)), 390 device_event_router_(new DeviceEventRouterImpl(profile)),
391 job_event_router_(new JobEventRouterImpl(profile)), 391 job_event_router_(new JobEventRouterImpl(profile)),
392 dispatch_directory_change_event_impl_( 392 dispatch_directory_change_event_impl_(
393 base::Bind(&EventRouter::DispatchDirectoryChangeEventImpl, 393 base::Bind(&EventRouter::DispatchDirectoryChangeEventImpl,
394 base::Unretained(this))), 394 base::Unretained(this))),
395 weak_factory_(this) { 395 weak_factory_(this) {
396 DCHECK_CURRENTLY_ON(BrowserThread::UI); 396 DCHECK_CURRENTLY_ON(BrowserThread::UI);
397 ObserveEvents(); 397 ObserveEvents();
398 } 398 }
399 399
400 EventRouter::~EventRouter() { 400 EventRouter::~EventRouter() {
hidehiko 2016/11/25 15:38:00 Optional: while you're here, how about s/{}/= defa
oka 2016/11/28 07:15:43 Done.
401 } 401 }
402 402
403 void EventRouter::OnAppsUpdated() {
404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
405 BroadcastEvent(profile_,
hidehiko 2016/11/25 17:10:44 Even if this EventRouter is for non-primary user p
oka 2016/11/28 07:15:43 Done.
406 extensions::events::FILE_MANAGER_PRIVATE_ON_APPS_UPDATED,
407 file_manager_private::OnAppsUpdated::kEventName,
408 file_manager_private::OnAppsUpdated::Create());
409 }
410
403 void EventRouter::Shutdown() { 411 void EventRouter::Shutdown() {
404 DCHECK_CURRENTLY_ON(BrowserThread::UI); 412 DCHECK_CURRENTLY_ON(BrowserThread::UI);
413
414 arc::ArcServiceManager::Get()->RemoveObserver(this);
415
405 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); 416 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this);
406 417
407 DLOG_IF(WARNING, !file_watchers_.empty()) 418 DLOG_IF(WARNING, !file_watchers_.empty())
408 << "Not all file watchers are " 419 << "Not all file watchers are "
409 << "removed. This can happen when Files.app is open during shutdown."; 420 << "removed. This can happen when Files.app is open during shutdown.";
410 file_watchers_.clear(); 421 file_watchers_.clear();
411 if (!profile_) { 422 if (!profile_) {
412 NOTREACHED(); 423 NOTREACHED();
413 return; 424 return;
414 } 425 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 base::Bind(&EventRouter::OnFileManagerPrefsChanged, 496 base::Bind(&EventRouter::OnFileManagerPrefsChanged,
486 weak_factory_.GetWeakPtr()); 497 weak_factory_.GetWeakPtr());
487 pref_change_registrar_->Add(drive::prefs::kDisableDriveOverCellular, 498 pref_change_registrar_->Add(drive::prefs::kDisableDriveOverCellular,
488 callback); 499 callback);
489 pref_change_registrar_->Add(drive::prefs::kDisableDriveHostedFiles, callback); 500 pref_change_registrar_->Add(drive::prefs::kDisableDriveHostedFiles, callback);
490 pref_change_registrar_->Add(drive::prefs::kDisableDrive, callback); 501 pref_change_registrar_->Add(drive::prefs::kDisableDrive, callback);
491 pref_change_registrar_->Add(prefs::kSearchSuggestEnabled, callback); 502 pref_change_registrar_->Add(prefs::kSearchSuggestEnabled, callback);
492 pref_change_registrar_->Add(prefs::kUse24HourClock, callback); 503 pref_change_registrar_->Add(prefs::kUse24HourClock, callback);
493 504
494 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); 505 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this);
506
507 arc::ArcServiceManager::Get()->AddObserver(this);
495 } 508 }
496 509
497 // File watch setup routines. 510 // File watch setup routines.
498 void EventRouter::AddFileWatch(const base::FilePath& local_path, 511 void EventRouter::AddFileWatch(const base::FilePath& local_path,
499 const base::FilePath& virtual_path, 512 const base::FilePath& virtual_path,
500 const std::string& extension_id, 513 const std::string& extension_id,
501 const BoolCallback& callback) { 514 const BoolCallback& callback) {
502 DCHECK_CURRENTLY_ON(BrowserThread::UI); 515 DCHECK_CURRENTLY_ON(BrowserThread::UI);
503 DCHECK(!callback.is_null()); 516 DCHECK(!callback.is_null());
504 517
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( 997 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting(
985 const DispatchDirectoryChangeEventImplCallback& callback) { 998 const DispatchDirectoryChangeEventImplCallback& callback) {
986 dispatch_directory_change_event_impl_ = callback; 999 dispatch_directory_change_event_impl_ = callback;
987 } 1000 }
988 1001
989 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { 1002 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() {
990 return weak_factory_.GetWeakPtr(); 1003 return weak_factory_.GetWeakPtr();
991 } 1004 }
992 1005
993 } // namespace file_manager 1006 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698