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 if (!play_store_enabled_ && arc::IsArcPlayStoreEnabledForProfile(profile)) { | |
Yusuke Sato
2017/03/27 21:38:47
+1 for adding a TODO here. TODO(hidehiko) should b
Daniel Erat
2017/03/27 22:04:16
Done.
| |
402 play_store_enabled_ = true; | |
403 for (auto& observer : observers_) | |
404 observer.OnAvailableNoteTakingAppsUpdated(); | |
Daniel Erat
2017/03/27 19:25:23
this notification is since we're now waiting for a
| |
405 } | |
398 } | 406 } |
399 | 407 |
400 void NoteTakingHelper::OnExtensionLoaded( | 408 void NoteTakingHelper::OnExtensionLoaded( |
401 content::BrowserContext* browser_context, | 409 content::BrowserContext* browser_context, |
402 const extensions::Extension* extension) { | 410 const extensions::Extension* extension) { |
403 if (IsWhitelistedChromeApp(extension) || | 411 if (IsWhitelistedChromeApp(extension) || |
404 extensions::ActionHandlersInfo::HasActionHandler( | 412 extensions::ActionHandlersInfo::HasActionHandler( |
405 extension, app_runtime::ACTION_TYPE_NEW_NOTE)) { | 413 extension, app_runtime::ACTION_TYPE_NEW_NOTE)) { |
406 for (auto& observer : observers_) | 414 for (auto& observer : observers_) |
407 observer.OnAvailableNoteTakingAppsUpdated(); | 415 observer.OnAvailableNoteTakingAppsUpdated(); |
(...skipping 10 matching lines...) Expand all Loading... | |
418 for (auto& observer : observers_) | 426 for (auto& observer : observers_) |
419 observer.OnAvailableNoteTakingAppsUpdated(); | 427 observer.OnAvailableNoteTakingAppsUpdated(); |
420 } | 428 } |
421 } | 429 } |
422 | 430 |
423 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { | 431 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { |
424 extension_registry_observer_.Remove(registry); | 432 extension_registry_observer_.Remove(registry); |
425 } | 433 } |
426 | 434 |
427 } // namespace chromeos | 435 } // namespace chromeos |
OLD | NEW |