| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/note_taking_helper.h" | 5 #include "chrome/browser/chromeos/note_taking_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "apps/launcher.h" | 10 #include "apps/launcher.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 launch_chrome_app_callback_.Run(profile, app, std::move(action_data), path); | 384 launch_chrome_app_callback_.Run(profile, app, std::move(action_data), path); |
| 385 return LaunchResult::CHROME_SUCCESS; | 385 return LaunchResult::CHROME_SUCCESS; |
| 386 } | 386 } |
| 387 NOTREACHED(); | 387 NOTREACHED(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 void NoteTakingHelper::Observe(int type, | 390 void NoteTakingHelper::Observe(int type, |
| 391 const content::NotificationSource& source, | 391 const content::NotificationSource& source, |
| 392 const content::NotificationDetails& details) { | 392 const content::NotificationDetails& details) { |
| 393 DCHECK_EQ(type, chrome::NOTIFICATION_PROFILE_ADDED); | 393 DCHECK_EQ(type, chrome::NOTIFICATION_PROFILE_ADDED); |
| 394 auto* registry = extensions::ExtensionRegistry::Get( | 394 Profile* profile = content::Source<Profile>(source).ptr(); |
| 395 content::Source<Profile>(source).ptr()); | 395 DCHECK(profile); |
| 396 |
| 397 auto* registry = extensions::ExtensionRegistry::Get(profile); |
| 396 DCHECK(!extension_registry_observer_.IsObserving(registry)); | 398 DCHECK(!extension_registry_observer_.IsObserving(registry)); |
| 397 extension_registry_observer_.Add(registry); | 399 extension_registry_observer_.Add(registry); |
| 400 |
| 401 // TODO(derat): Remove this once OnArcPlayStoreEnabledChanged() is always |
| 402 // called after an ARC-enabled user logs in: http://b/36655474 |
| 403 if (!play_store_enabled_ && arc::IsArcPlayStoreEnabledForProfile(profile)) { |
| 404 play_store_enabled_ = true; |
| 405 for (auto& observer : observers_) |
| 406 observer.OnAvailableNoteTakingAppsUpdated(); |
| 407 } |
| 398 } | 408 } |
| 399 | 409 |
| 400 void NoteTakingHelper::OnExtensionLoaded( | 410 void NoteTakingHelper::OnExtensionLoaded( |
| 401 content::BrowserContext* browser_context, | 411 content::BrowserContext* browser_context, |
| 402 const extensions::Extension* extension) { | 412 const extensions::Extension* extension) { |
| 403 if (IsWhitelistedChromeApp(extension) || | 413 if (IsWhitelistedChromeApp(extension) || |
| 404 extensions::ActionHandlersInfo::HasActionHandler( | 414 extensions::ActionHandlersInfo::HasActionHandler( |
| 405 extension, app_runtime::ACTION_TYPE_NEW_NOTE)) { | 415 extension, app_runtime::ACTION_TYPE_NEW_NOTE)) { |
| 406 for (auto& observer : observers_) | 416 for (auto& observer : observers_) |
| 407 observer.OnAvailableNoteTakingAppsUpdated(); | 417 observer.OnAvailableNoteTakingAppsUpdated(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 418 for (auto& observer : observers_) | 428 for (auto& observer : observers_) |
| 419 observer.OnAvailableNoteTakingAppsUpdated(); | 429 observer.OnAvailableNoteTakingAppsUpdated(); |
| 420 } | 430 } |
| 421 } | 431 } |
| 422 | 432 |
| 423 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { | 433 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { |
| 424 extension_registry_observer_.Remove(registry); | 434 extension_registry_observer_.Remove(registry); |
| 425 } | 435 } |
| 426 | 436 |
| 427 } // namespace chromeos | 437 } // namespace chromeos |
| OLD | NEW |