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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return true; | 339 return true; |
340 } | 340 } |
341 | 341 |
342 // Sub-part of the event router for handling device events. | 342 // Sub-part of the event router for handling device events. |
343 class DeviceEventRouterImpl : public DeviceEventRouter { | 343 class DeviceEventRouterImpl : public DeviceEventRouter { |
344 public: | 344 public: |
345 explicit DeviceEventRouterImpl(Profile* profile) : profile_(profile) {} | 345 explicit DeviceEventRouterImpl(Profile* profile) : profile_(profile) {} |
346 | 346 |
347 // DeviceEventRouter overrides. | 347 // DeviceEventRouter overrides. |
348 virtual void OnDeviceEvent(file_manager_private::DeviceEventType type, | 348 virtual void OnDeviceEvent(file_manager_private::DeviceEventType type, |
349 const std::string& device_path) OVERRIDE { | 349 const std::string& device_path) override { |
350 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 350 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
351 | 351 |
352 file_manager_private::DeviceEvent event; | 352 file_manager_private::DeviceEvent event; |
353 event.type = type; | 353 event.type = type; |
354 event.device_path = device_path; | 354 event.device_path = device_path; |
355 | 355 |
356 BroadcastEvent(profile_, | 356 BroadcastEvent(profile_, |
357 file_manager_private::OnDeviceChanged::kEventName, | 357 file_manager_private::OnDeviceChanged::kEventName, |
358 file_manager_private::OnDeviceChanged::Create(event)); | 358 file_manager_private::OnDeviceChanged::Create(event)); |
359 } | 359 } |
360 | 360 |
361 // DeviceEventRouter overrides. | 361 // DeviceEventRouter overrides. |
362 virtual bool IsExternalStorageDisabled() OVERRIDE { | 362 virtual bool IsExternalStorageDisabled() override { |
363 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 363 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
364 return profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled); | 364 return profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled); |
365 } | 365 } |
366 | 366 |
367 private: | 367 private: |
368 Profile* const profile_; | 368 Profile* const profile_; |
369 | 369 |
370 DISALLOW_COPY_AND_ASSIGN(DeviceEventRouterImpl); | 370 DISALLOW_COPY_AND_ASSIGN(DeviceEventRouterImpl); |
371 }; | 371 }; |
372 | 372 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 const content::NotificationSource& source, | 961 const content::NotificationSource& source, |
962 const content::NotificationDetails& details) { | 962 const content::NotificationDetails& details) { |
963 if (type == chrome::NOTIFICATION_PROFILE_ADDED) { | 963 if (type == chrome::NOTIFICATION_PROFILE_ADDED) { |
964 Profile* const added_profile = content::Source<Profile>(source).ptr(); | 964 Profile* const added_profile = content::Source<Profile>(source).ptr(); |
965 if (!added_profile->IsOffTheRecord()) | 965 if (!added_profile->IsOffTheRecord()) |
966 GrantAccessForAddedProfileToRunningInstance(added_profile, profile_); | 966 GrantAccessForAddedProfileToRunningInstance(added_profile, profile_); |
967 } | 967 } |
968 } | 968 } |
969 | 969 |
970 } // namespace file_manager | 970 } // namespace file_manager |
OLD | NEW |