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

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

Issue 2108643007: Revert of arc: Implement silent OptIn mode for managed Arc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 kCode[] = "code";
31 const char kCanEnable[] = "canEnable"; 32 const char kCanEnable[] = "canEnable";
32 const char kCode[] = "code"; 33 const char kStatus[] = "status";
33 const char kCountryCode[] = "countryCode";
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";
39 const char kPage[] = "page"; 37 const char kPage[] = "page";
40 const char kText[] = "text"; 38 const char kText[] = "text";
41 const char kActionInitialize[] = "initialize"; 39 const char kActionInitialize[] = "initialize";
42 const char kActionSetMetricsMode[] = "setMetricsMode"; 40 const char kActionSetMetricsMode[] = "setMetricsMode";
43 const char kActionStartLso[] = "startLso"; 41 const char kActionStartLso[] = "startLso";
44 const char kActionCancelAuthCode[] = "cancelAuthCode"; 42 const char kActionCancelAuthCode[] = "cancelAuthCode";
45 const char kActionSetAuthCode[] = "setAuthCode"; 43 const char kActionSetAuthCode[] = "setAuthCode";
46 const char kActionEnableMetrics[] = "enableMetrics"; 44 const char kActionEnableMetrics[] = "enableMetrics";
47 const char kActionSendFeedback[] = "sendFeedback"; 45 const char kActionSendFeedback[] = "sendFeedback";
48 const char kActionCloseUI[] = "closeUI"; 46 const char kActionCloseUI[] = "closeUI";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_ANDROID)); 129 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_ANDROID));
132 localized_strings->SetString( 130 localized_strings->SetString(
133 "authorizationFailed", 131 "authorizationFailed",
134 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_AUTHORIZATION_FAILED)); 132 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_AUTHORIZATION_FAILED));
135 localized_strings->SetString( 133 localized_strings->SetString(
136 "termsOfService", 134 "termsOfService",
137 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_TERMS_OF_SERVICE)); 135 l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_TERMS_OF_SERVICE));
138 136
139 const std::string& app_locale = g_browser_process->GetApplicationLocale(); 137 const std::string& app_locale = g_browser_process->GetApplicationLocale();
140 const std::string& country_code = base::CountryCodeForCurrentTimezone(); 138 const std::string& country_code = base::CountryCodeForCurrentTimezone();
141 localized_strings->SetString(kCountryCode, country_code); 139 localized_strings->SetString("countryCode", country_code);
142 140
143 webui::SetLoadTimeDataDefaults(app_locale, localized_strings.get()); 141 webui::SetLoadTimeDataDefaults(app_locale, localized_strings.get());
144 142
145 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get(); 143 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get();
146 DCHECK(arc_auth_service); 144 DCHECK(arc_auth_service);
147 const std::string device_id = user_manager::known_user::GetDeviceId( 145 const std::string device_id = user_manager::known_user::GetDeviceId(
148 multi_user_util::GetAccountIdFromProfile(arc_auth_service->profile())); 146 multi_user_util::GetAccountIdFromProfile(arc_auth_service->profile()));
149 DCHECK(!device_id.empty()); 147 DCHECK(!device_id.empty());
150 148
151 base::DictionaryValue request; 149 base::DictionaryValue request;
152 std::string request_string; 150 std::string request_string;
153 request.SetString(kAction, kActionInitialize); 151 request.SetString(kAction, kActionInitialize);
154 request.Set(kData, std::move(localized_strings)); 152 request.Set(kData, std::move(localized_strings));
155 request.SetString(kDeviceId, device_id); 153 request.SetString(kDeviceId, device_id);
156 request.SetBoolean(kSilentMode, arc_auth_service->IsArcManaged());
157
158 base::JSONWriter::Write(request, &request_string); 154 base::JSONWriter::Write(request, &request_string);
159 client_->PostMessageFromNativeHost(request_string); 155 client_->PostMessageFromNativeHost(request_string);
160 } 156 }
161 157
162 void ArcSupportHost::OnMetricsPreferenceChanged() { 158 void ArcSupportHost::OnMetricsPreferenceChanged() {
163 SendMetricsMode(); 159 SendMetricsMode();
164 } 160 }
165 161
166 void ArcSupportHost::SendMetricsMode() { 162 void ArcSupportHost::SendMetricsMode() {
167 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get(); 163 arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 chrome::OpenFeedbackDialog(nullptr); 254 chrome::OpenFeedbackDialog(nullptr);
259 } else { 255 } else {
260 NOTREACHED(); 256 NOTREACHED();
261 } 257 }
262 } 258 }
263 259
264 scoped_refptr<base::SingleThreadTaskRunner> ArcSupportHost::task_runner() 260 scoped_refptr<base::SingleThreadTaskRunner> ArcSupportHost::task_runner()
265 const { 261 const {
266 return base::ThreadTaskRunnerHandle::Get(); 262 return base::ThreadTaskRunnerHandle::Get();
267 } 263 }
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