Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_utils.cc

Issue 2322353002: [Merge-M53] arc: Add support of default and OEM apps. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 bool LaunchApp(content::BrowserContext* context, 218 bool LaunchApp(content::BrowserContext* context,
219 const std::string& app_id, 219 const std::string& app_id,
220 bool landscape_layout) { 220 bool landscape_layout) {
221 const ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); 221 const ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
222 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); 222 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id);
223 if (app_info && !app_info->ready) { 223 if (app_info && !app_info->ready) {
224 if (!ash::Shell::HasInstance()) 224 if (!ash::Shell::HasInstance())
225 return false; 225 return false;
226 226
227 ArcAuthService* auth_service = ArcAuthService::Get();
228 DCHECK(auth_service);
229
230 if (!auth_service->IsArcEnabled()) {
231 if (!prefs->IsDefault(app_id)) {
232 NOTREACHED();
233 return false;
234 }
235
236 auth_service->EnableArc();
237 if (!auth_service->IsArcEnabled()) {
238 NOTREACHED();
239 return false;
240 }
241 }
242
227 ChromeLauncherController* chrome_controller = 243 ChromeLauncherController* chrome_controller =
228 ChromeLauncherController::instance(); 244 ChromeLauncherController::instance();
229 DCHECK(chrome_controller); 245 DCHECK(chrome_controller);
230 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id); 246 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id);
231 return true; 247 return true;
232 } 248 }
233 249
234 return (new LaunchAppWithoutSize(context, app_id, landscape_layout)) 250 return (new LaunchAppWithoutSize(context, app_id, landscape_layout))
235 ->LaunchAndRelease(); 251 ->LaunchAndRelease();
236 } 252 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 if (!app_instance) 335 if (!app_instance)
320 return false; 336 return false;
321 337
322 app_instance->ShowPackageInfoOnPage( 338 app_instance->ShowPackageInfoOnPage(
323 package_name, page, 339 package_name, page,
324 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); 340 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height)));
325 return true; 341 return true;
326 } 342 }
327 343
328 } // namespace arc 344 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_unittest.cc ('k') | chrome/browser/ui/app_list/arc/arc_default_app_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698