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" |
11 #include "ash/common/wallpaper/wallpaper_controller.h" | 11 #include "ash/common/wallpaper/wallpaper_controller.h" |
12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "components/arc/arc_bridge_service.h" | 16 #include "components/arc/arc_bridge_service.h" |
17 #include "components/arc/arc_service_manager.h" | 17 #include "components/arc/arc_service_manager.h" |
| 18 #include "components/arc/arc_util.h" |
18 #include "components/arc/intent_helper/activity_icon_loader.h" | 19 #include "components/arc/intent_helper/activity_icon_loader.h" |
19 #include "components/arc/intent_helper/link_handler_model_impl.h" | 20 #include "components/arc/intent_helper/link_handler_model_impl.h" |
20 #include "components/arc/intent_helper/local_activity_resolver.h" | 21 #include "components/arc/intent_helper/local_activity_resolver.h" |
21 #include "ui/base/layout.h" | 22 #include "ui/base/layout.h" |
22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
23 | 24 |
24 namespace arc { | 25 namespace arc { |
25 | 26 |
26 // static | 27 // static |
27 const char ArcIntentHelperBridge::kArcServiceName[] = | 28 const char ArcIntentHelperBridge::kArcServiceName[] = |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 continue; | 127 continue; |
127 handlers_filtered.push_back(std::move(handler)); | 128 handlers_filtered.push_back(std::move(handler)); |
128 } | 129 } |
129 return handlers_filtered; | 130 return handlers_filtered; |
130 } | 131 } |
131 | 132 |
132 // static | 133 // static |
133 bool ArcIntentHelperBridge::IsIntentHelperAvailable(GetResult* out_error_code) { | 134 bool ArcIntentHelperBridge::IsIntentHelperAvailable(GetResult* out_error_code) { |
134 auto* arc_service_manager = ArcServiceManager::Get(); | 135 auto* arc_service_manager = ArcServiceManager::Get(); |
135 if (!arc_service_manager) { | 136 if (!arc_service_manager) { |
136 if (!ArcBridgeService::GetEnabled(base::CommandLine::ForCurrentProcess())) { | 137 // TODO(hidehiko): IsArcAvailable() looks not the condition to be checked |
| 138 // here, because ArcServiceManager instance is created regardless of ARC |
| 139 // availability. This happens only before MessageLoop starts or after |
| 140 // MessageLoop stops, practically. |
| 141 // Also, returning FAILED_ARC_NOT_READY looks problematic at the moment, |
| 142 // because ArcProcessTask::StartIconLoading accesses to |
| 143 // ArcServiceManager::Get() return value, which can be nullptr. |
| 144 if (!IsArcAvailable()) { |
137 VLOG(2) << "ARC bridge is not supported."; | 145 VLOG(2) << "ARC bridge is not supported."; |
138 if (out_error_code) | 146 if (out_error_code) |
139 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; | 147 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; |
140 } else { | 148 } else { |
141 VLOG(2) << "ARC bridge is not ready."; | 149 VLOG(2) << "ARC bridge is not ready."; |
142 if (out_error_code) | 150 if (out_error_code) |
143 *out_error_code = GetResult::FAILED_ARC_NOT_READY; | 151 *out_error_code = GetResult::FAILED_ARC_NOT_READY; |
144 } | 152 } |
145 return false; | 153 return false; |
146 } | 154 } |
(...skipping 13 matching lines...) Expand all Loading... |
160 void ArcIntentHelperBridge::OnIntentFiltersUpdated( | 168 void ArcIntentHelperBridge::OnIntentFiltersUpdated( |
161 std::vector<IntentFilter> filters) { | 169 std::vector<IntentFilter> filters) { |
162 DCHECK(thread_checker_.CalledOnValidThread()); | 170 DCHECK(thread_checker_.CalledOnValidThread()); |
163 activity_resolver_->UpdateIntentFilters(std::move(filters)); | 171 activity_resolver_->UpdateIntentFilters(std::move(filters)); |
164 | 172 |
165 for (auto& observer : observer_list_) | 173 for (auto& observer : observer_list_) |
166 observer.OnIntentFiltersUpdated(); | 174 observer.OnIntentFiltersUpdated(); |
167 } | 175 } |
168 | 176 |
169 } // namespace arc | 177 } // namespace arc |
OLD | NEW |