| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_item.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_item.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 8 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 9 #include "components/arc/arc_bridge_service.h" | 9 #include "components/arc/arc_bridge_service.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile()); | 54 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile()); |
| 55 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id()); | 55 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id()); |
| 56 if (!app_info) { | 56 if (!app_info) { |
| 57 VLOG(2) << "Cannot launch unavailable app:" << id() << "."; | 57 VLOG(2) << "Cannot launch unavailable app:" << id() << "."; |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 | 60 |
| 61 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get(); | 61 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get(); |
| 62 if (!bridge_service) { | 62 if (!bridge_service || |
| 63 VLOG(2) << "Request to launch app when bridge service is not ready: " | 63 bridge_service->state() != arc::ArcBridgeService::State::READY) { |
| 64 << id() << "."; | 64 VLOG(2) << "Cannot launch app: " << app_info->package |
| 65 return; | 65 << ". Bridge service is not ready."; |
| 66 } | |
| 67 arc::AppInstance* app_instance = bridge_service->app_instance(); | |
| 68 if (!app_instance) { | |
| 69 VLOG(2) << "Request to launch app when bridge service is not ready: " | |
| 70 << id() << "."; | |
| 71 return; | 66 return; |
| 72 } | 67 } |
| 73 | 68 |
| 74 app_instance->LaunchApp(app_info->package, app_info->activity); | 69 bridge_service->LaunchApp(app_info->package, app_info->activity); |
| 75 } | 70 } |
| 76 | 71 |
| 77 void ArcAppItem::SetReady(bool ready) { | 72 void ArcAppItem::SetReady(bool ready) { |
| 78 if (ready_ == ready) | 73 if (ready_ == ready) |
| 79 return; | 74 return; |
| 80 | 75 |
| 81 ready_ = ready; | 76 ready_ = ready; |
| 82 UpdateIcon(); | 77 UpdateIcon(); |
| 83 } | 78 } |
| 84 | 79 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 105 GetAppSorting()->GetNaturalAppPageOrdinal(); | 100 GetAppSorting()->GetNaturalAppPageOrdinal(); |
| 106 // And get next available pos in this page. | 101 // And get next available pos in this page. |
| 107 const syncer::StringOrdinal& pos = | 102 const syncer::StringOrdinal& pos = |
| 108 GetAppSorting()->CreateNextAppLaunchOrdinal(page); | 103 GetAppSorting()->CreateNextAppLaunchOrdinal(page); |
| 109 set_position(pos); | 104 set_position(pos); |
| 110 } | 105 } |
| 111 | 106 |
| 112 void ArcAppItem::OnIconUpdated() { | 107 void ArcAppItem::OnIconUpdated() { |
| 113 UpdateIcon(); | 108 UpdateIcon(); |
| 114 } | 109 } |
| OLD | NEW |