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/ui/app_list/arc/arc_app_utils.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 bool LaunchApp(content::BrowserContext* context, | 219 bool LaunchApp(content::BrowserContext* context, |
220 const std::string& app_id, | 220 const std::string& app_id, |
221 bool landscape_layout) { | 221 bool landscape_layout) { |
222 const ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); | 222 const ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); |
223 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); | 223 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); |
224 if (app_info && !app_info->ready) { | 224 if (app_info && !app_info->ready) { |
225 if (!ash::Shell::HasInstance()) | 225 if (!ash::Shell::HasInstance()) |
226 return false; | 226 return false; |
227 | 227 |
| 228 ArcAuthService* auth_service = ArcAuthService::Get(); |
| 229 DCHECK(auth_service); |
| 230 |
| 231 if (!auth_service->IsArcEnabled()) { |
| 232 if (!prefs->IsDefault(app_id)) { |
| 233 NOTREACHED(); |
| 234 return false; |
| 235 } |
| 236 |
| 237 auth_service->EnableArc(); |
| 238 if (!auth_service->IsArcEnabled()) { |
| 239 NOTREACHED(); |
| 240 return false; |
| 241 } |
| 242 } |
| 243 |
228 ChromeLauncherController* chrome_controller = | 244 ChromeLauncherController* chrome_controller = |
229 ChromeLauncherController::instance(); | 245 ChromeLauncherController::instance(); |
230 DCHECK(chrome_controller); | 246 DCHECK(chrome_controller); |
231 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id); | 247 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id); |
232 return true; | 248 return true; |
233 } | 249 } |
234 | 250 |
235 return (new LaunchAppWithoutSize(context, app_id, landscape_layout)) | 251 return (new LaunchAppWithoutSize(context, app_id, landscape_layout)) |
236 ->LaunchAndRelease(); | 252 ->LaunchAndRelease(); |
237 } | 253 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 if (!app_instance) | 361 if (!app_instance) |
346 return false; | 362 return false; |
347 | 363 |
348 app_instance->ShowPackageInfoOnPage( | 364 app_instance->ShowPackageInfoOnPage( |
349 package_name, page, | 365 package_name, page, |
350 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); | 366 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); |
351 return true; | 367 return true; |
352 } | 368 } |
353 | 369 |
354 } // namespace arc | 370 } // namespace arc |
OLD | NEW |