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

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

Issue 2642783003: Move more utility functions to arc_util. (Closed)
Patch Set: Revert IsIntentHelperAvailable fix. 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"
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"
15 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
16 #include "components/arc/arc_bridge_service.h" 15 #include "components/arc/arc_bridge_service.h"
17 #include "components/arc/arc_service_manager.h" 16 #include "components/arc/arc_service_manager.h"
17 #include "components/arc/arc_util.h"
18 #include "components/arc/intent_helper/activity_icon_loader.h" 18 #include "components/arc/intent_helper/activity_icon_loader.h"
19 #include "components/arc/intent_helper/link_handler_model_impl.h" 19 #include "components/arc/intent_helper/link_handler_model_impl.h"
20 #include "components/arc/intent_helper/local_activity_resolver.h" 20 #include "components/arc/intent_helper/local_activity_resolver.h"
21 #include "ui/base/layout.h" 21 #include "ui/base/layout.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 namespace arc { 24 namespace arc {
25 25
26 // static 26 // static
27 const char ArcIntentHelperBridge::kArcServiceName[] = 27 const char ArcIntentHelperBridge::kArcServiceName[] =
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 continue; 126 continue;
127 handlers_filtered.push_back(std::move(handler)); 127 handlers_filtered.push_back(std::move(handler));
128 } 128 }
129 return handlers_filtered; 129 return handlers_filtered;
130 } 130 }
131 131
132 // static 132 // static
133 bool ArcIntentHelperBridge::IsIntentHelperAvailable(GetResult* out_error_code) { 133 bool ArcIntentHelperBridge::IsIntentHelperAvailable(GetResult* out_error_code) {
134 auto* arc_service_manager = ArcServiceManager::Get(); 134 auto* arc_service_manager = ArcServiceManager::Get();
135 if (!arc_service_manager) { 135 if (!arc_service_manager) {
136 if (!ArcBridgeService::GetEnabled(base::CommandLine::ForCurrentProcess())) { 136 if (!arc::util::IsArcEnabled()) {
hidehiko 2017/01/19 06:57:26 FYI to yusukes@. IIUC, this check is not up-to-da
Yusuke Sato 2017/01/19 22:39:31 That's fine but I also think we can remove the fun
137 VLOG(2) << "ARC bridge is not supported."; 137 VLOG(2) << "ARC service is not supported.";
138 if (out_error_code) 138 if (out_error_code)
139 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; 139 *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED;
140 } else { 140 } else {
141 VLOG(2) << "ARC bridge is not ready."; 141 VLOG(2) << "ARC service is not ready.";
142 if (out_error_code) 142 if (out_error_code)
143 *out_error_code = GetResult::FAILED_ARC_NOT_READY; 143 *out_error_code = GetResult::FAILED_ARC_NOT_READY;
144 } 144 }
145 return false; 145 return false;
146 } 146 }
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 false; 154 return false;
155 } 155 }
156 156
157 return true; 157 return true;
158 } 158 }
159 159
160 void ArcIntentHelperBridge::OnIntentFiltersUpdated( 160 void ArcIntentHelperBridge::OnIntentFiltersUpdated(
161 std::vector<IntentFilter> filters) { 161 std::vector<IntentFilter> filters) {
162 DCHECK(thread_checker_.CalledOnValidThread()); 162 DCHECK(thread_checker_.CalledOnValidThread());
163 activity_resolver_->UpdateIntentFilters(std::move(filters)); 163 activity_resolver_->UpdateIntentFilters(std::move(filters));
164 164
165 for (auto& observer : observer_list_) 165 for (auto& observer : observer_list_)
166 observer.OnIntentFiltersUpdated(); 166 observer.OnIntentFiltersUpdated();
167 } 167 }
168 168
169 } // namespace arc 169 } // namespace arc
OLDNEW
« components/arc/arc_util.cc ('K') | « components/arc/arc_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698