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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_utils.cc

Issue 2220453002: Add a button to open TalkBack settings in chrome://settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review Created 4 years, 4 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 "chrome/browser/ui/app_list/arc/arc_app_utils.h" 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 23
24 // Default sizes to use. 24 // Default sizes to use.
25 constexpr int kNexus7Width = 960; 25 constexpr int kNexus7Width = 960;
26 constexpr int kNexus7Height = 600; 26 constexpr int kNexus7Height = 600;
27 constexpr int kNexus5Width = 410; 27 constexpr int kNexus5Width = 410;
28 constexpr int kNexus5Height = 690; 28 constexpr int kNexus5Height = 690;
29 29
30 // Minimum required versions. 30 // Minimum required versions.
31 constexpr int kMinVersion = 0; 31 constexpr int kMinVersion = 0;
32 constexpr int kCanHandleResolutionMinVersion = 1; 32 constexpr int kCanHandleResolutionMinVersion = 1;
33 constexpr int kSendBroadcastMinVersion = 1;
33 constexpr int kUninstallPackageMinVersion = 2; 34 constexpr int kUninstallPackageMinVersion = 2;
34 constexpr int kShowPackageInfoMinVersion = 5; 35 constexpr int kShowPackageInfoMinVersion = 5;
35 constexpr int kRemoveIconMinVersion = 9; 36 constexpr int kRemoveIconMinVersion = 9;
36 constexpr int kShowPackageInfoOnPageMinVersion = 10; 37 constexpr int kShowPackageInfoOnPageMinVersion = 10;
37 38
38 // Service name strings. 39 // Service name strings.
39 constexpr char kCanHandleResolutionStr[] = "get resolution capability"; 40 constexpr char kCanHandleResolutionStr[] = "get resolution capability";
40 constexpr char kLaunchAppStr[] = "launch app"; 41 constexpr char kLaunchAppStr[] = "launch app";
41 constexpr char kShowPackageInfoStr[] = "show package info"; 42 constexpr char kShowPackageInfoStr[] = "show package info";
42 constexpr char kUninstallPackageStr[] = "uninstall package"; 43 constexpr char kUninstallPackageStr[] = "uninstall package";
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 ChromeLauncherController::instance(); 221 ChromeLauncherController::instance();
221 DCHECK(chrome_controller); 222 DCHECK(chrome_controller);
222 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id); 223 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id);
223 return true; 224 return true;
224 } 225 }
225 226
226 return (new LaunchAppWithoutSize(context, app_id, landscape_layout)) 227 return (new LaunchAppWithoutSize(context, app_id, landscape_layout))
227 ->LaunchAndRelease(); 228 ->LaunchAndRelease();
228 } 229 }
229 230
231 void ShowTalkBackSettings() {
232 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
233 if (!bridge_service) {
234 VLOG(2) << "ARC bridge is not ready";
235 return;
236 }
237
238 arc::mojom::IntentHelperInstance *intent_helper_instance =
239 bridge_service->intent_helper()->instance();
240 if (!intent_helper_instance) {
241 VLOG(2) << "ARC intent helper instance is not ready";
242 return;
243 }
244 if (bridge_service->intent_helper()->version() < kSendBroadcastMinVersion) {
245 VLOG(2) << "ARC intent helper instance is too old";
246 return;
247 }
248
249 intent_helper_instance->SendBroadcast(
250 "org.chromium.arc.intent_helper.SHOW_TALKBACK_SETTINGS",
251 "org.chromium.arc.intent_helper",
252 "org.chromium.arc.intent_helper.SettingsReceiver",
253 "{}");
254 }
255
230 bool CanHandleResolution(content::BrowserContext* context, 256 bool CanHandleResolution(content::BrowserContext* context,
231 const std::string& app_id, 257 const std::string& app_id,
232 const gfx::Rect& rect, 258 const gfx::Rect& rect,
233 const CanHandleResolutionCallback& callback) { 259 const CanHandleResolutionCallback& callback) {
234 const ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); 260 const ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
235 DCHECK(prefs); 261 DCHECK(prefs);
236 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); 262 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id);
237 if (!app_info) { 263 if (!app_info) {
238 VLOG(2) << "Cannot test resolution capability of unavailable app:" << app_id 264 VLOG(2) << "Cannot test resolution capability of unavailable app:" << app_id
239 << "."; 265 << ".";
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (!app_instance) 321 if (!app_instance)
296 return false; 322 return false;
297 323
298 app_instance->ShowPackageInfoOnPage( 324 app_instance->ShowPackageInfoOnPage(
299 package_name, page, 325 package_name, page,
300 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); 326 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height)));
301 return true; 327 return true;
302 } 328 }
303 329
304 } // namespace arc 330 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_utils.h ('k') | chrome/browser/ui/webui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698