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

Side by Side Diff: chrome/browser/chromeos/arc/arc_support_host.cc

Issue 2102793002: arc: Implement silent OptIn mode for managed Arc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 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/chromeos/arc/arc_support_host.h" 5 #include "chrome/browser/chromeos/arc/arc_support_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/common/system/chromeos/devicetype_utils.h" 9 #include "ash/common/system/chromeos/devicetype_utils.h"
10 #include "base/i18n/timezone.h" 10 #include "base/i18n/timezone.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/ui/browser_commands.h" 21 #include "chrome/browser/ui/browser_commands.h"
22 #include "chrome/grit/generated_resources.h" 22 #include "chrome/grit/generated_resources.h"
23 #include "components/metrics/metrics_pref_names.h" 23 #include "components/metrics/metrics_pref_names.h"
24 #include "components/prefs/pref_service.h" 24 #include "components/prefs/pref_service.h"
25 #include "components/user_manager/known_user.h" 25 #include "components/user_manager/known_user.h"
26 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/webui/web_ui_util.h" 27 #include "ui/base/webui/web_ui_util.h"
28 28
29 namespace { 29 namespace {
30 const char kAction[] = "action"; 30 const char kAction[] = "action";
31 const char kCanEnable[] = "canEnable";
31 const char kCode[] = "code"; 32 const char kCode[] = "code";
32 const char kCanEnable[] = "canEnable"; 33 const char kCountryCode[] = "countryCode";
33 const char kStatus[] = "status";
34 const char kData[] = "data"; 34 const char kData[] = "data";
35 const char kDeviceId[] = "deviceId"; 35 const char kDeviceId[] = "deviceId";
36 const char kOn[] = "on"; 36 const char kOn[] = "on";
37 const char kSilentMode[] = "silentMode";
38 const char kStatus[] = "status";
37 const char kPage[] = "page"; 39 const char kPage[] = "page";
38 const char kText[] = "text"; 40 const char kText[] = "text";
39 const char kActionInitialize[] = "initialize"; 41 const char kActionInitialize[] = "initialize";
40 const char kActionSetMetricsMode[] = "setMetricsMode"; 42 const char kActionSetMetricsMode[] = "setMetricsMode";
41 const char kActionStartLso[] = "startLso"; 43 const char kActionStartLso[] = "startLso";
42 const char kActionCancelAuthCode[] = "cancelAuthCode"; 44 const char kActionCancelAuthCode[] = "cancelAuthCode";
43 const char kActionSetAuthCode[] = "setAuthCode"; 45 const char kActionSetAuthCode[] = "setAuthCode";
44 const char kActionEnableMetrics[] = "enableMetrics"; 46 const char kActionEnableMetrics[] = "enableMetrics";
45 const char kActionSendFeedback[] = "sendFeedback"; 47 const char kActionSendFeedback[] = "sendFeedback";
46 const char kActionCloseUI[] = "closeUI"; 48 const char kActionCloseUI[] = "closeUI";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_ANDROID)); 131 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_ANDROID));
130 localized_strings->SetString( 132 localized_strings->SetString(
131 "authorizationFailed", 133 "authorizationFailed",
132 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_AUTHORIZATION_FAILED)); 134 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_AUTHORIZATION_FAILED));
133 localized_strings->SetString( 135 localized_strings->SetString(
134 "termsOfService", 136 "termsOfService",
135 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_TERMS_OF_SERVICE)); 137 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_TERMS_OF_SERVICE));
136 138
137 const std::string& app_locale = g_browser_process->GetApplicationLocale(); 139 const std::string& app_locale = g_browser_process->GetApplicationLocale();
138 const std::string& country_code = base::CountryCodeForCurrentTimezone(); 140 const std::string& country_code = base::CountryCodeForCurrentTimezone();
139 localized_strings->SetString("countryCode", country_code); 141 localized_strings->SetString(kCountryCode, country_code);
140 142
141 webui::SetLoadTimeDataDefaults(app_locale, localized_strings.get()); 143 webui::SetLoadTimeDataDefaults(app_locale, localized_strings.get());
142 144
143 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get(); 145 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get();
144 DCHECK(arc_auth_service); 146 DCHECK(arc_auth_service);
145 const std::string device_id = user_manager::known_user::GetDeviceId( 147 const std::string device_id = user_manager::known_user::GetDeviceId(
146 multi_user_util::GetAccountIdFromProfile(arc_auth_service->profile())); 148 multi_user_util::GetAccountIdFromProfile(arc_auth_service->profile()));
147 DCHECK(!device_id.empty()); 149 DCHECK(!device_id.empty());
148 150
149 base::DictionaryValue request; 151 base::DictionaryValue request;
150 std::string request_string; 152 std::string request_string;
151 request.SetString(kAction, kActionInitialize); 153 request.SetString(kAction, kActionInitialize);
152 request.Set(kData, std::move(localized_strings)); 154 request.Set(kData, std::move(localized_strings));
153 request.SetString(kDeviceId, device_id); 155 request.SetString(kDeviceId, device_id);
156 request.SetBoolean(kSilentMode, arc_auth_service->IsArcManaged());
157
154 base::JSONWriter::Write(request, &request_string); 158 base::JSONWriter::Write(request, &request_string);
155 client_->PostMessageFromNativeHost(request_string); 159 client_->PostMessageFromNativeHost(request_string);
156 } 160 }
157 161
158 void ArcSupportHost::OnMetricsPreferenceChanged() { 162 void ArcSupportHost::OnMetricsPreferenceChanged() {
159 SendMetricsMode(); 163 SendMetricsMode();
160 } 164 }
161 165
162 void ArcSupportHost::SendMetricsMode() { 166 void ArcSupportHost::SendMetricsMode() {
163 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get(); 167 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 chrome::OpenFeedbackDialog(nullptr); 258 chrome::OpenFeedbackDialog(nullptr);
255 } else { 259 } else {
256 NOTREACHED(); 260 NOTREACHED();
257 } 261 }
258 } 262 }
259 263
260 scoped_refptr<base::SingleThreadTaskRunner> ArcSupportHost::task_runner() 264 scoped_refptr<base::SingleThreadTaskRunner> ArcSupportHost::task_runner()
261 const { 265 const {
262 return base::ThreadTaskRunnerHandle::Get(); 266 return base::ThreadTaskRunnerHandle::Get();
263 } 267 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.cc ('k') | chrome/browser/resources/chromeos/arc_support/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698