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