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

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: Notify Files App when ARC++ app is installed/removed. Created 4 years, 1 month 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 19 matching lines...) Expand all
30 #include "chrome/browser/extensions/extension_service.h" 30 #include "chrome/browser/extensions/extension_service.h"
31 #include "chrome/browser/extensions/extension_util.h" 31 #include "chrome/browser/extensions/extension_util.h"
32 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/browser/profiles/profile_manager.h" 33 #include "chrome/browser/profiles/profile_manager.h"
34 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
36 #include "chromeos/dbus/dbus_thread_manager.h" 36 #include "chromeos/dbus/dbus_thread_manager.h"
37 #include "chromeos/login/login_state.h" 37 #include "chromeos/login/login_state.h"
38 #include "chromeos/network/network_handler.h" 38 #include "chromeos/network/network_handler.h"
39 #include "chromeos/network/network_state_handler.h" 39 #include "chromeos/network/network_state_handler.h"
40 #include "components/arc/intent_helper/arc_intent_helper_bridge.h"
Yusuke Sato 2016/11/17 02:29:54 nit: Remove. You can rely on the header file in th
oka 2016/11/21 07:02:15 Done.
40 #include "components/drive/chromeos/file_system_interface.h" 41 #include "components/drive/chromeos/file_system_interface.h"
41 #include "components/drive/drive_pref_names.h" 42 #include "components/drive/drive_pref_names.h"
42 #include "components/drive/file_change.h" 43 #include "components/drive/file_change.h"
43 #include "components/drive/service/drive_service_interface.h" 44 #include "components/drive/service/drive_service_interface.h"
44 #include "components/prefs/pref_change_registrar.h" 45 #include "components/prefs/pref_change_registrar.h"
45 #include "components/prefs/pref_service.h" 46 #include "components/prefs/pref_service.h"
46 #include "content/public/browser/browser_thread.h" 47 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/render_process_host.h" 48 #include "content/public/browser/render_process_host.h"
48 #include "content/public/browser/storage_partition.h" 49 #include "content/public/browser/storage_partition.h"
49 #include "extensions/browser/event_router.h" 50 #include "extensions/browser/event_router.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 base::Bind(&EventRouter::DispatchDirectoryChangeEventImpl, 394 base::Bind(&EventRouter::DispatchDirectoryChangeEventImpl,
394 base::Unretained(this))), 395 base::Unretained(this))),
395 weak_factory_(this) { 396 weak_factory_(this) {
396 DCHECK_CURRENTLY_ON(BrowserThread::UI); 397 DCHECK_CURRENTLY_ON(BrowserThread::UI);
397 ObserveEvents(); 398 ObserveEvents();
398 } 399 }
399 400
400 EventRouter::~EventRouter() { 401 EventRouter::~EventRouter() {
401 } 402 }
402 403
404 void EventRouter::OnAppsUpdated() {
405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
406 BroadcastEvent(profile_,
407 extensions::events::FILE_MANAGER_PRIVATE_ON_APPS_UPDATED,
408 file_manager_private::OnAppsUpdated::kEventName,
409 file_manager_private::OnAppsUpdated::Create());
410 }
411
403 void EventRouter::Shutdown() { 412 void EventRouter::Shutdown() {
404 DCHECK_CURRENTLY_ON(BrowserThread::UI); 413 DCHECK_CURRENTLY_ON(BrowserThread::UI);
405 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); 414 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this);
406 415
407 DLOG_IF(WARNING, !file_watchers_.empty()) 416 DLOG_IF(WARNING, !file_watchers_.empty())
408 << "Not all file watchers are " 417 << "Not all file watchers are "
409 << "removed. This can happen when Files.app is open during shutdown."; 418 << "removed. This can happen when Files.app is open during shutdown.";
410 file_watchers_.clear(); 419 file_watchers_.clear();
411 if (!profile_) { 420 if (!profile_) {
412 NOTREACHED(); 421 NOTREACHED();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 base::Bind(&EventRouter::OnFileManagerPrefsChanged, 494 base::Bind(&EventRouter::OnFileManagerPrefsChanged,
486 weak_factory_.GetWeakPtr()); 495 weak_factory_.GetWeakPtr());
487 pref_change_registrar_->Add(drive::prefs::kDisableDriveOverCellular, 496 pref_change_registrar_->Add(drive::prefs::kDisableDriveOverCellular,
488 callback); 497 callback);
489 pref_change_registrar_->Add(drive::prefs::kDisableDriveHostedFiles, callback); 498 pref_change_registrar_->Add(drive::prefs::kDisableDriveHostedFiles, callback);
490 pref_change_registrar_->Add(drive::prefs::kDisableDrive, callback); 499 pref_change_registrar_->Add(drive::prefs::kDisableDrive, callback);
491 pref_change_registrar_->Add(prefs::kSearchSuggestEnabled, callback); 500 pref_change_registrar_->Add(prefs::kSearchSuggestEnabled, callback);
492 pref_change_registrar_->Add(prefs::kUse24HourClock, callback); 501 pref_change_registrar_->Add(prefs::kUse24HourClock, callback);
493 502
494 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); 503 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this);
504
505 arc::ArcIntentHelperBridge* bridge = arc::ArcIntentHelperBridge::Get();
506 DCHECK(bridge);
kinaba 2016/11/17 01:47:19 When ARC is not enabled (either by config or when
Yusuke Sato 2016/11/17 02:29:54 Yeah, and you might have to retry later to avoid i
Yusuke Sato 2016/11/17 04:22:37 Sorry I misread your code. ArcIntentHelperBridge i
hidehiko 2016/11/17 07:34:19 I think no. In past, the launcher creation was gua
Yusuke Sato 2016/11/17 09:15:27 Got it, thanks for refreshing my memory.
507 bridge->AddObserver(this);
Yusuke Sato 2016/11/17 02:29:54 AddObserver should almost always be paired with Re
oka 2016/11/21 07:02:15 Done.
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