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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 void NoteTakingHelper::SetPreferredApp(Profile* profile, | 144 void NoteTakingHelper::SetPreferredApp(Profile* profile, |
145 const std::string& app_id) { | 145 const std::string& app_id) { |
146 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 146 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
147 DCHECK(profile); | 147 DCHECK(profile); |
148 profile->GetPrefs()->SetString(prefs::kNoteTakingAppId, app_id); | 148 profile->GetPrefs()->SetString(prefs::kNoteTakingAppId, app_id); |
149 } | 149 } |
150 | 150 |
151 bool NoteTakingHelper::IsAppAvailable(Profile* profile) { | 151 bool NoteTakingHelper::IsAppAvailable(Profile* profile) { |
152 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 152 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
153 DCHECK(profile); | 153 DCHECK(profile); |
154 return ash::IsPaletteFeatureEnabled() && !GetAvailableApps(profile).empty(); | 154 return ash::palette_utils::HasStylusInput() && |
| 155 !GetAvailableApps(profile).empty(); |
155 } | 156 } |
156 | 157 |
157 void NoteTakingHelper::LaunchAppForNewNote(Profile* profile, | 158 void NoteTakingHelper::LaunchAppForNewNote(Profile* profile, |
158 const base::FilePath& path) { | 159 const base::FilePath& path) { |
159 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 160 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
160 DCHECK(profile); | 161 DCHECK(profile); |
161 | 162 |
162 LaunchResult result = LaunchResult::NO_APP_SPECIFIED; | 163 LaunchResult result = LaunchResult::NO_APP_SPECIFIED; |
163 std::string app_id = profile->GetPrefs()->GetString(prefs::kNoteTakingAppId); | 164 std::string app_id = profile->GetPrefs()->GetString(prefs::kNoteTakingAppId); |
164 if (!app_id.empty()) | 165 if (!app_id.empty()) |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 for (auto& observer : observers_) | 414 for (auto& observer : observers_) |
414 observer.OnAvailableNoteTakingAppsUpdated(); | 415 observer.OnAvailableNoteTakingAppsUpdated(); |
415 } | 416 } |
416 } | 417 } |
417 | 418 |
418 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { | 419 void NoteTakingHelper::OnShutdown(extensions::ExtensionRegistry* registry) { |
419 extension_registry_observer_.Remove(registry); | 420 extension_registry_observer_.Remove(registry); |
420 } | 421 } |
421 | 422 |
422 } // namespace chromeos | 423 } // namespace chromeos |
OLD | NEW |