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 bridge_service->state() != arc::ArcBridgeService::State::READY) { | 63 VLOG(2) << "Request to launch app when bridge service is not ready: " |
64 VLOG(2) << "Cannot launch app: " << app_info->package | 64 << id() << "."; |
65 << ". Bridge service is not ready."; | 65 return; |
| 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() << "."; |
66 return; | 71 return; |
67 } | 72 } |
68 | 73 |
69 bridge_service->LaunchApp(app_info->package, app_info->activity); | 74 app_instance->LaunchApp(app_info->package, app_info->activity); |
70 } | 75 } |
71 | 76 |
72 void ArcAppItem::SetReady(bool ready) { | 77 void ArcAppItem::SetReady(bool ready) { |
73 if (ready_ == ready) | 78 if (ready_ == ready) |
74 return; | 79 return; |
75 | 80 |
76 ready_ = ready; | 81 ready_ = ready; |
77 UpdateIcon(); | 82 UpdateIcon(); |
78 } | 83 } |
79 | 84 |
(...skipping 20 matching lines...) Expand all Loading... |
100 GetAppSorting()->GetNaturalAppPageOrdinal(); | 105 GetAppSorting()->GetNaturalAppPageOrdinal(); |
101 // And get next available pos in this page. | 106 // And get next available pos in this page. |
102 const syncer::StringOrdinal& pos = | 107 const syncer::StringOrdinal& pos = |
103 GetAppSorting()->CreateNextAppLaunchOrdinal(page); | 108 GetAppSorting()->CreateNextAppLaunchOrdinal(page); |
104 set_position(pos); | 109 set_position(pos); |
105 } | 110 } |
106 | 111 |
107 void ArcAppItem::OnIconUpdated() { | 112 void ArcAppItem::OnIconUpdated() { |
108 UpdateIcon(); | 113 UpdateIcon(); |
109 } | 114 } |
OLD | NEW |