| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 bool LaunchAppWithRect(content::BrowserContext* context, | 123 bool LaunchAppWithRect(content::BrowserContext* context, |
| 124 const std::string& app_id, | 124 const std::string& app_id, |
| 125 const gfx::Rect& target_rect) { | 125 const gfx::Rect& target_rect) { |
| 126 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); | 126 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); |
| 127 CHECK(prefs); | 127 CHECK(prefs); |
| 128 | 128 |
| 129 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); | 129 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); |
| 130 if (!app_info) { | 130 if (!app_info) { |
| 131 VLOG(2) << "Cannot launch unavailable app: " << app_id << "."; | 131 VLOG(2) << "Cannot launch unavailable app: " << app_id << "."; |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 | 134 |
| 135 if (!app_info->ready) { | 135 if (!app_info->ready) { |
| 136 VLOG(2) << "Cannot launch not-ready app: " << app_id << "."; | 136 VLOG(2) << "Cannot launch not-ready app: " << app_id << "."; |
| 137 return false; | 137 return false; |
| 138 } | 138 } |
| 139 | 139 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 165 | 165 |
| 166 bool LaunchApp(content::BrowserContext* context, const std::string& app_id) { | 166 bool LaunchApp(content::BrowserContext* context, const std::string& app_id) { |
| 167 return (new LaunchAppWithoutSize(context, app_id))->LaunchAndRelease(); | 167 return (new LaunchAppWithoutSize(context, app_id))->LaunchAndRelease(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool CanHandleResolution(content::BrowserContext* context, | 170 bool CanHandleResolution(content::BrowserContext* context, |
| 171 const std::string& app_id, | 171 const std::string& app_id, |
| 172 const gfx::Rect& rect, | 172 const gfx::Rect& rect, |
| 173 const CanHandleResolutionCallback& callback) { | 173 const CanHandleResolutionCallback& callback) { |
| 174 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); | 174 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); |
| 175 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); | 175 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); |
| 176 if (!app_info) { | 176 if (!app_info) { |
| 177 VLOG(2) << "Cannot test resolution capability of unavailable app:" << app_id | 177 VLOG(2) << "Cannot test resolution capability of unavailable app:" << app_id |
| 178 << "."; | 178 << "."; |
| 179 return false; | 179 return false; |
| 180 } | 180 } |
| 181 | 181 |
| 182 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get(); | 182 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get(); |
| 183 arc::AppInstance* app_instance = | 183 arc::AppInstance* app_instance = |
| 184 bridge_service ? bridge_service->app_instance() : nullptr; | 184 bridge_service ? bridge_service->app_instance() : nullptr; |
| 185 if (!app_instance) { | 185 if (!app_instance) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 if (bridge_service->app_version() < 2) { | 225 if (bridge_service->app_version() < 2) { |
| 226 LOG(ERROR) << "Request to uninstall package when version " | 226 LOG(ERROR) << "Request to uninstall package when version " |
| 227 << bridge_service->app_version() << " does not support it"; | 227 << bridge_service->app_version() << " does not support it"; |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 app_instance->UninstallPackage(package_name); | 230 app_instance->UninstallPackage(package_name); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace arc | 233 } // namespace arc |
| OLD | NEW |