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

Side by Side Diff: components/arc/intent_helper/arc_intent_helper_bridge.cc

Issue 2599673005: arc: Use GET_INTERFACE_FOR_METHOD macro (Closed)
Patch Set: Added a conversion I missed Created 3 years, 11 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 unified diff | Download patch
OLDNEW
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
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 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
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 auto* instance = intent_helper_holder->GetInstanceForVersion(
158 method_name_for_logging, min_instance_version); 158 min_instance_version, method_name_for_logging.c_str());
Yusuke Sato 2017/01/04 19:59:13 Same. Could you remove kMinInstanceVersion in acti
Luis Héctor Chávez 2017/01/04 20:38:56 Added TODO.
159 if (!instance) { 159 if (!instance) {
160 if (out_error_code) 160 if (out_error_code)
161 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; 161 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED;
162 return nullptr; 162 return nullptr;
163 } 163 }
164 return instance; 164 return instance;
165 } 165 }
166 166
167 // static 167 // static
168 mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance( 168 mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance(
169 const std::string& method_name_for_logging, 169 const std::string& method_name_for_logging,
170 uint32_t min_instance_version) { 170 uint32_t min_instance_version) {
171 return GetIntentHelperInstanceWithErrorCode(method_name_for_logging, 171 return GetIntentHelperInstanceWithErrorCode(method_name_for_logging,
172 min_instance_version, nullptr); 172 min_instance_version, nullptr);
173 } 173 }
174 174
175 void ArcIntentHelperBridge::OnIntentFiltersUpdated( 175 void ArcIntentHelperBridge::OnIntentFiltersUpdated(
176 std::vector<IntentFilter> filters) { 176 std::vector<IntentFilter> filters) {
177 DCHECK(thread_checker_.CalledOnValidThread()); 177 DCHECK(thread_checker_.CalledOnValidThread());
178 activity_resolver_->UpdateIntentFilters(std::move(filters)); 178 activity_resolver_->UpdateIntentFilters(std::move(filters));
179 179
180 for (auto& observer : observer_list_) 180 for (auto& observer : observer_list_)
181 observer.OnIntentFiltersUpdated(); 181 observer.OnIntentFiltersUpdated();
182 } 182 }
183 183
184 } // namespace arc 184 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698