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

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

Issue 2337193005: Consolidate 4 GetIntentHelper functions (Closed)
Patch Set: Address comments2 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
« no previous file with comments | « components/arc/intent_helper/arc_intent_helper_bridge.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4b3b6be1a18b68c39541a974d5f301454c3b799e 100644
--- a/components/arc/intent_helper/link_handler_model_impl.cc
+++ b/components/arc/intent_helper/link_handler_model_impl.cc
@@ -56,7 +56,8 @@ LinkHandlerModelImpl::LinkHandlerModelImpl(
LinkHandlerModelImpl::~LinkHandlerModelImpl() {}
bool LinkHandlerModelImpl::Init(const GURL& url) {
- mojom::IntentHelperInstance* intent_helper_instance = GetIntentHelper();
+ mojom::IntentHelperInstance* intent_helper_instance =
+ ArcIntentHelperBridge::GetIntentHelperInstance(kMinInstanceVersion);
if (!intent_helper_instance)
return false;
@@ -77,7 +78,8 @@ 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);
if (!intent_helper_instance)
return;
if (handler_id >= handlers_.size())
@@ -87,25 +89,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));
« no previous file with comments | « components/arc/intent_helper/arc_intent_helper_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698