Chromium Code Reviews| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 whitelisted_chrome_app_ids_ = base::SplitString( | 214 whitelisted_chrome_app_ids_ = base::SplitString( |
| 215 switch_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 215 switch_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 216 } | 216 } |
| 217 whitelisted_chrome_app_ids_.insert(whitelisted_chrome_app_ids_.end(), | 217 whitelisted_chrome_app_ids_.insert(whitelisted_chrome_app_ids_.end(), |
| 218 kExtensionIds, | 218 kExtensionIds, |
| 219 kExtensionIds + arraysize(kExtensionIds)); | 219 kExtensionIds + arraysize(kExtensionIds)); |
| 220 | 220 |
| 221 // Track profiles so we can observe their extension registries. | 221 // Track profiles so we can observe their extension registries. |
| 222 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, | 222 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, |
| 223 content::NotificationService::AllBrowserContextsAndSources()); | 223 content::NotificationService::AllBrowserContextsAndSources()); |
| 224 android_enabled_ = false; | |
| 224 for (Profile* profile : | 225 for (Profile* profile : |
| 225 g_browser_process->profile_manager()->GetLoadedProfiles()) { | 226 g_browser_process->profile_manager()->GetLoadedProfiles()) { |
| 226 extension_registry_observer_.Add( | 227 extension_registry_observer_.Add( |
| 227 extensions::ExtensionRegistry::Get(profile)); | 228 extensions::ExtensionRegistry::Get(profile)); |
| 229 // Check if the profile has already enabled Google Play Store. | |
| 230 // IsArcPlayStoreEnabledForProfile() can return true only for the primary | |
|
Yusuke Sato
2017/02/17 22:27:09
Hmm.. but the primary profile thing is not mention
hidehiko
2017/02/20 18:18:44
Hmm, I thought the combination of "if ARC is not a
Yusuke Sato
2017/02/21 20:59:43
Yes, thanks.
| |
| 231 // profile. | |
| 232 android_enabled_ |= arc::IsArcPlayStoreEnabledForProfile(profile); | |
| 228 } | 233 } |
| 229 | 234 |
| 230 // Check if the primary profile has already enabled ARC and watch for changes. | 235 // Watch for changes of Google Play Store enabled state. |
| 231 auto session_manager = arc::ArcSessionManager::Get(); | 236 auto session_manager = arc::ArcSessionManager::Get(); |
| 232 session_manager->AddObserver(this); | 237 session_manager->AddObserver(this); |
| 233 android_enabled_ = session_manager->IsArcPlayStoreEnabled(); | |
| 234 | 238 |
| 235 // ArcIntentHelperBridge will notify us about changes to the list of available | 239 // ArcIntentHelperBridge will notify us about changes to the list of available |
| 236 // Android apps. | 240 // Android apps. |
| 237 auto intent_helper_bridge = | 241 auto intent_helper_bridge = |
| 238 arc::ArcServiceManager::GetGlobalService<arc::ArcIntentHelperBridge>(); | 242 arc::ArcServiceManager::GetGlobalService<arc::ArcIntentHelperBridge>(); |
| 239 if (intent_helper_bridge) | 243 if (intent_helper_bridge) |
| 240 intent_helper_bridge->AddObserver(this); | 244 intent_helper_bridge->AddObserver(this); |
| 241 | 245 |
| 242 // If the ARC intent helper is ready, get the Android apps. Otherwise, | 246 // If the ARC intent helper is ready, get the Android apps. Otherwise, |
| 243 // UpdateAndroidApps() will be called when ArcServiceManager calls | 247 // UpdateAndroidApps() will be called when ArcServiceManager calls |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 for (auto& observer : observers_) | 418 for (auto& observer : observers_) |
| 415 observer.OnAvailableNoteTakingAppsUpdated(); | 419 observer.OnAvailableNoteTakingAppsUpdated(); |
| 416 } | 420 } |
| 417 } | 421 } |
| 418 | 422 |
| 419 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { | 423 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { |
| 420 extension_registry_observer_.Remove(registry); | 424 extension_registry_observer_.Remove(registry); |
| 421 } | 425 } |
| 422 | 426 |
| 423 } // namespace chromeos | 427 } // namespace chromeos |
| OLD | NEW |