| 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 | 8 |
| 9 #include "ash/common/new_window_controller.h" | 9 #include "ash/common/new_window_controller.h" |
| 10 #include "ash/common/shell_delegate.h" | 10 #include "ash/common/shell_delegate.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 ArcIntentHelperBridge::~ArcIntentHelperBridge() { | 42 ArcIntentHelperBridge::~ArcIntentHelperBridge() { |
| 43 DCHECK(thread_checker_.CalledOnValidThread()); | 43 DCHECK(thread_checker_.CalledOnValidThread()); |
| 44 arc_bridge_service()->intent_helper()->RemoveObserver(this); | 44 arc_bridge_service()->intent_helper()->RemoveObserver(this); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ArcIntentHelperBridge::OnInstanceReady() { | 47 void ArcIntentHelperBridge::OnInstanceReady() { |
| 48 DCHECK(thread_checker_.CalledOnValidThread()); | 48 DCHECK(thread_checker_.CalledOnValidThread()); |
| 49 ash::Shell::GetInstance()->set_link_handler_model_factory(this); | 49 ash::Shell::GetInstance()->set_link_handler_model_factory(this); |
| 50 auto* instance = | 50 auto* instance = |
| 51 arc_bridge_service()->intent_helper()->GetInstanceForMethod("Init"); | 51 ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->intent_helper(), Init); |
| 52 DCHECK(instance); | 52 DCHECK(instance); |
| 53 instance->Init(binding_.CreateInterfacePtrAndBind()); | 53 instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ArcIntentHelperBridge::OnInstanceClosed() { | 56 void ArcIntentHelperBridge::OnInstanceClosed() { |
| 57 DCHECK(thread_checker_.CalledOnValidThread()); | 57 DCHECK(thread_checker_.CalledOnValidThread()); |
| 58 ash::Shell::GetInstance()->set_link_handler_model_factory(nullptr); | 58 ash::Shell::GetInstance()->set_link_handler_model_factory(nullptr); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void ArcIntentHelperBridge::OnIconInvalidated(const std::string& package_name) { | 61 void ArcIntentHelperBridge::OnIconInvalidated(const std::string& package_name) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 auto* intent_helper_holder = | 148 auto* intent_helper_holder = |
| 149 arc_service_manager->arc_bridge_service()->intent_helper(); | 149 arc_service_manager->arc_bridge_service()->intent_helper(); |
| 150 if (!intent_helper_holder->has_instance()) { | 150 if (!intent_helper_holder->has_instance()) { |
| 151 VLOG(2) << "ARC intent helper instance is not ready."; | 151 VLOG(2) << "ARC intent helper instance is not ready."; |
| 152 if (out_error_code) | 152 if (out_error_code) |
| 153 *out_error_code = GetResult::FAILED_ARC_NOT_READY; | 153 *out_error_code = GetResult::FAILED_ARC_NOT_READY; |
| 154 return nullptr; | 154 return nullptr; |
| 155 } | 155 } |
| 156 | 156 |
| 157 auto* instance = intent_helper_holder->GetInstanceForMethod( | 157 // TODO(lhchavez): Stop calling GetInstanceForVersion() directly. |
| 158 method_name_for_logging, min_instance_version); | 158 auto* instance = intent_helper_holder->GetInstanceForVersion( |
| 159 min_instance_version, method_name_for_logging.c_str()); |
| 159 if (!instance) { | 160 if (!instance) { |
| 160 if (out_error_code) | 161 if (out_error_code) |
| 161 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; | 162 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; |
| 162 return nullptr; | 163 return nullptr; |
| 163 } | 164 } |
| 164 return instance; | 165 return instance; |
| 165 } | 166 } |
| 166 | 167 |
| 167 // static | 168 // static |
| 168 mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance( | 169 mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance( |
| 169 const std::string& method_name_for_logging, | 170 const std::string& method_name_for_logging, |
| 170 uint32_t min_instance_version) { | 171 uint32_t min_instance_version) { |
| 171 return GetIntentHelperInstanceWithErrorCode(method_name_for_logging, | 172 return GetIntentHelperInstanceWithErrorCode(method_name_for_logging, |
| 172 min_instance_version, nullptr); | 173 min_instance_version, nullptr); |
| 173 } | 174 } |
| 174 | 175 |
| 175 void ArcIntentHelperBridge::OnIntentFiltersUpdated( | 176 void ArcIntentHelperBridge::OnIntentFiltersUpdated( |
| 176 std::vector<IntentFilter> filters) { | 177 std::vector<IntentFilter> filters) { |
| 177 DCHECK(thread_checker_.CalledOnValidThread()); | 178 DCHECK(thread_checker_.CalledOnValidThread()); |
| 178 activity_resolver_->UpdateIntentFilters(std::move(filters)); | 179 activity_resolver_->UpdateIntentFilters(std::move(filters)); |
| 179 | 180 |
| 180 for (auto& observer : observer_list_) | 181 for (auto& observer : observer_list_) |
| 181 observer.OnIntentFiltersUpdated(); | 182 observer.OnIntentFiltersUpdated(); |
| 182 } | 183 } |
| 183 | 184 |
| 184 } // namespace arc | 185 } // namespace arc |
| OLD | NEW |