Chromium Code Reviews| 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 "components/arc/intent_helper/arc_intent_helper_bridge.h" | 5 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/new_window_delegate.h" | 10 #include "ash/common/new_window_delegate.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { | 119 mojo::Array<mojom::UrlHandlerInfoPtr> handlers) { |
| 120 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_filtered; | 120 mojo::Array<mojom::UrlHandlerInfoPtr> handlers_filtered; |
| 121 for (auto& handler : handlers) { | 121 for (auto& handler : handlers) { |
| 122 if (IsIntentHelperPackage(handler->package_name.get())) | 122 if (IsIntentHelperPackage(handler->package_name.get())) |
| 123 continue; | 123 continue; |
| 124 handlers_filtered.push_back(std::move(handler)); | 124 handlers_filtered.push_back(std::move(handler)); |
| 125 } | 125 } |
| 126 return handlers_filtered; | 126 return handlers_filtered; |
| 127 } | 127 } |
| 128 | 128 |
| 129 // static | |
| 130 mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance( | |
| 131 int min_instance_version, | |
| 132 GetResult* out_error_code) { | |
| 133 ArcBridgeService* bridge_service = ArcBridgeService::Get(); | |
| 134 if (!bridge_service) { | |
| 135 VLOG(2) << "ARC bridge is not ready."; | |
| 136 if (out_error_code) | |
| 137 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; | |
|
Luis Héctor Chávez
2016/09/14 20:28:49
Shouldn't this be FAILED_ARC_NOT_READY? Unless Arc
Yusuke Sato
2016/09/14 21:02:25
Good point, fixed. Done.
| |
| 138 return nullptr; | |
| 139 } | |
| 140 mojom::IntentHelperInstance* intent_helper_instance = | |
| 141 bridge_service->intent_helper()->instance(); | |
| 142 if (!intent_helper_instance) { | |
| 143 VLOG(2) << "ARC intent helper instance is not ready."; | |
| 144 if (out_error_code) | |
| 145 *out_error_code = GetResult::FAILED_ARC_NOT_READY; | |
| 146 return nullptr; | |
| 147 } | |
| 148 const int version = bridge_service->intent_helper()->version(); | |
| 149 if (version < min_instance_version) { | |
| 150 VLOG(1) << "ARC intent helper instance is too old. required: " | |
| 151 << min_instance_version << ", actual: " << version; | |
| 152 if (out_error_code) | |
| 153 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; | |
| 154 return nullptr; | |
| 155 } | |
| 156 return intent_helper_instance; | |
| 157 } | |
| 158 | |
| 129 void ArcIntentHelperBridge::OnIntentFiltersUpdated( | 159 void ArcIntentHelperBridge::OnIntentFiltersUpdated( |
| 130 mojo::Array<mojom::IntentFilterPtr> filters) { | 160 mojo::Array<mojom::IntentFilterPtr> filters) { |
| 131 DCHECK(thread_checker_.CalledOnValidThread()); | 161 DCHECK(thread_checker_.CalledOnValidThread()); |
| 132 activity_resolver_->UpdateIntentFilters(std::move(filters)); | 162 activity_resolver_->UpdateIntentFilters(std::move(filters)); |
| 133 } | 163 } |
| 134 | 164 |
| 135 } // namespace arc | 165 } // namespace arc |
| OLD | NEW |