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

Unified Diff: components/arc/intent_helper/link_handler_model_impl.cc

Issue 2337193005: Consolidate 4 GetIntentHelper functions (Closed)
Patch Set: review 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/intent_helper/link_handler_model_impl.cc
diff --git a/components/arc/intent_helper/link_handler_model_impl.cc b/components/arc/intent_helper/link_handler_model_impl.cc
index e808ad89106b0c16de57bd88ac24814e485faae6..d16d33529788620dd58fbcca1be14c3c8a7f1d0a 100644
--- a/components/arc/intent_helper/link_handler_model_impl.cc
+++ b/components/arc/intent_helper/link_handler_model_impl.cc
@@ -56,7 +56,9 @@ LinkHandlerModelImpl::LinkHandlerModelImpl(
LinkHandlerModelImpl::~LinkHandlerModelImpl() {}
bool LinkHandlerModelImpl::Init(const GURL& url) {
- mojom::IntentHelperInstance* intent_helper_instance = GetIntentHelper();
+ mojom::IntentHelperInstance* intent_helper_instance =
+ ArcIntentHelperBridge::GetIntentHelperInstance(kMinInstanceVersion,
+ nullptr);
if (!intent_helper_instance)
return false;
@@ -77,7 +79,9 @@ void LinkHandlerModelImpl::AddObserver(Observer* observer) {
void LinkHandlerModelImpl::OpenLinkWithHandler(const GURL& url,
uint32_t handler_id) {
- mojom::IntentHelperInstance* intent_helper_instance = GetIntentHelper();
+ mojom::IntentHelperInstance* intent_helper_instance =
+ ArcIntentHelperBridge::GetIntentHelperInstance(kMinInstanceVersion,
+ nullptr);
if (!intent_helper_instance)
return;
if (handler_id >= handlers_.size())
@@ -87,25 +91,6 @@ void LinkHandlerModelImpl::OpenLinkWithHandler(const GURL& url,
handlers_[handler_id]->package_name);
}
-mojom::IntentHelperInstance* LinkHandlerModelImpl::GetIntentHelper() {
- ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
- if (!bridge_service) {
- DLOG(WARNING) << "ARC bridge is not ready.";
- return nullptr;
- }
- mojom::IntentHelperInstance* intent_helper_instance =
- bridge_service->intent_helper()->instance();
- if (!intent_helper_instance) {
- DLOG(WARNING) << "ARC intent helper instance is not ready.";
- return nullptr;
- }
- if (bridge_service->intent_helper()->version() < kMinInstanceVersion) {
- DLOG(WARNING) << "ARC intent helper instance is too old.";
- return nullptr;
- }
- return intent_helper_instance;
-}
-
void LinkHandlerModelImpl::OnUrlHandlerList(
mojo::Array<mojom::UrlHandlerInfoPtr> handlers) {
handlers_ = ArcIntentHelperBridge::FilterOutIntentHelper(std::move(handlers));

Powered by Google App Engine
This is Rietveld 408576698