| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void NoteTakingHelper::SetPreferredApp(Profile* profile, | 142 void NoteTakingHelper::SetPreferredApp(Profile* profile, |
| 143 const std::string& app_id) { | 143 const std::string& app_id) { |
| 144 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 144 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 145 DCHECK(profile); | 145 DCHECK(profile); |
| 146 profile->GetPrefs()->SetString(prefs::kNoteTakingAppId, app_id); | 146 profile->GetPrefs()->SetString(prefs::kNoteTakingAppId, app_id); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool NoteTakingHelper::IsAppAvailable(Profile* profile) { | 149 bool NoteTakingHelper::IsAppAvailable(Profile* profile) { |
| 150 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 150 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 151 DCHECK(profile); | 151 DCHECK(profile); |
| 152 return ash::IsPaletteFeatureEnabled() && !GetAvailableApps(profile).empty(); | 152 return ash::HasStylusInput() && !GetAvailableApps(profile).empty(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void NoteTakingHelper::LaunchAppForNewNote(Profile* profile, | 155 void NoteTakingHelper::LaunchAppForNewNote(Profile* profile, |
| 156 const base::FilePath& path) { | 156 const base::FilePath& path) { |
| 157 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 157 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 158 DCHECK(profile); | 158 DCHECK(profile); |
| 159 | 159 |
| 160 LaunchResult result = LaunchResult::NO_APP_SPECIFIED; | 160 LaunchResult result = LaunchResult::NO_APP_SPECIFIED; |
| 161 std::string app_id = profile->GetPrefs()->GetString(prefs::kNoteTakingAppId); | 161 std::string app_id = profile->GetPrefs()->GetString(prefs::kNoteTakingAppId); |
| 162 if (!app_id.empty()) | 162 if (!app_id.empty()) |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 for (auto& observer : observers_) | 398 for (auto& observer : observers_) |
| 399 observer.OnAvailableNoteTakingAppsUpdated(); | 399 observer.OnAvailableNoteTakingAppsUpdated(); |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 | 402 |
| 403 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { | 403 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { |
| 404 extension_registry_observer_.Remove(registry); | 404 extension_registry_observer_.Remove(registry); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace chromeos | 407 } // namespace chromeos |
| OLD | NEW |