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/ui/webui/settings/about_handler.cc

Issue 2897773002: Show proper message in about Chrome OS page (Closed)
Patch Set: Created 3 years, 7 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/webui/settings/about_handler.h" 5 #include "chrome/browser/ui/webui/settings/about_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" 62 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h"
63 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 63 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
64 #include "chrome/browser/chromeos/profiles/profile_helper.h" 64 #include "chrome/browser/chromeos/profiles/profile_helper.h"
65 #include "chrome/browser/chromeos/settings/cros_settings.h" 65 #include "chrome/browser/chromeos/settings/cros_settings.h"
66 #include "chrome/browser/profiles/profile.h" 66 #include "chrome/browser/profiles/profile.h"
67 #include "chrome/browser/ui/webui/chromeos/image_source.h" 67 #include "chrome/browser/ui/webui/chromeos/image_source.h"
68 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" 68 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h"
69 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h" 69 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h"
70 #include "chromeos/chromeos_switches.h" 70 #include "chromeos/chromeos_switches.h"
71 #include "chromeos/dbus/power_manager_client.h" 71 #include "chromeos/dbus/power_manager_client.h"
72 #include "chromeos/network/network_state.h"
73 #include "chromeos/network/network_state_handler.h"
72 #include "chromeos/system/statistics_provider.h" 74 #include "chromeos/system/statistics_provider.h"
73 #include "components/user_manager/user_manager.h" 75 #include "components/user_manager/user_manager.h"
74 #endif 76 #endif
75 77
76 using base::ListValue; 78 using base::ListValue;
77 using content::BrowserThread; 79 using content::BrowserThread;
78 80
79 namespace { 81 namespace {
80 82
81 #if defined(OS_CHROMEOS) 83 #if defined(OS_CHROMEOS)
82 84
83 // Directory containing the regulatory labels for supported regions. 85 // Directory containing the regulatory labels for supported regions.
84 const char kRegulatoryLabelsDirectory[] = "regulatory_labels"; 86 const char kRegulatoryLabelsDirectory[] = "regulatory_labels";
85 87
86 // File names of the image file and the file containing alt text for the label. 88 // File names of the image file and the file containing alt text for the label.
87 const char kRegulatoryLabelImageFilename[] = "label.png"; 89 const char kRegulatoryLabelImageFilename[] = "label.png";
88 const char kRegulatoryLabelTextFilename[] = "label.txt"; 90 const char kRegulatoryLabelTextFilename[] = "label.txt";
89 91
90 // Default region code to use if there's no label for the VPD region code. 92 // Default region code to use if there's no label for the VPD region code.
91 const char kDefaultRegionCode[] = "us"; 93 const char kDefaultRegionCode[] = "us";
92 94
93 struct RegulatoryLabel { 95 struct RegulatoryLabel {
94 const std::string label_text; 96 const std::string label_text;
95 const std::string image_url; 97 const std::string image_url;
96 }; 98 };
97 99
98 // Returns message that informs user that for update it's better to 100 // Returns message that informs user that for update it's better to
99 // connect to a network of one of the allowed types. 101 // connect to a network of one of the allowed types.
100 base::string16 GetAllowedConnectionTypesMessage() { 102 base::string16 GetAllowedConnectionTypesMessage() {
101 if (help_utils_chromeos::IsUpdateOverCellularAllowed()) { 103 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get()
102 return l10n_util::GetStringUTF16(IDS_UPGRADE_NETWORK_LIST_CELLULAR_ALLOWED); 104 ->network_state_handler()
105 ->DefaultNetwork();
106 bool cellular = network && network->IsConnectedState() &&
xiyuan 2017/05/22 18:14:08 nit: const bool
weidongg 2017/05/22 19:02:54 Done.
107 network->type() == shill::kTypeCellular;
108
109 if (help_utils_chromeos::IsUpdateOverCellularAllowed(
110 true /* interactive */)) {
111 return cellular ? l10n_util::GetStringUTF16(
112 IDS_UPGRADE_NETWORK_LIST_CELLULAR_NOT_RECOMMENDED)
113 : l10n_util::GetStringUTF16(
114 IDS_UPGRADE_NETWORK_LIST_CELLULAR_ALLOWED);
103 } else { 115 } else {
104 return l10n_util::GetStringUTF16( 116 return l10n_util::GetStringUTF16(
105 IDS_UPGRADE_NETWORK_LIST_CELLULAR_DISALLOWED); 117 IDS_UPGRADE_NETWORK_LIST_CELLULAR_DISALLOWED);
106 } 118 }
107 } 119 }
108 120
109 // Returns true if the device is enterprise managed, false otherwise. 121 // Returns true if the device is enterprise managed, false otherwise.
110 bool IsEnterpriseManaged() { 122 bool IsEnterpriseManaged() {
111 policy::BrowserPolicyConnectorChromeOS* connector = 123 policy::BrowserPolicyConnectorChromeOS* connector =
112 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 124 g_browser_process->platform_part()->browser_policy_connector_chromeos();
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 label_dir_path.AppendASCII(kRegulatoryLabelImageFilename).MaybeAsASCII(); 687 label_dir_path.AppendASCII(kRegulatoryLabelImageFilename).MaybeAsASCII();
676 std::string url = 688 std::string url =
677 std::string("chrome://") + chrome::kChromeOSAssetHost + "/" + image_path; 689 std::string("chrome://") + chrome::kChromeOSAssetHost + "/" + image_path;
678 regulatory_info->SetString("url", url); 690 regulatory_info->SetString("url", url);
679 691
680 ResolveJavascriptCallback(base::Value(callback_id), *regulatory_info); 692 ResolveJavascriptCallback(base::Value(callback_id), *regulatory_info);
681 } 693 }
682 #endif // defined(OS_CHROMEOS) 694 #endif // defined(OS_CHROMEOS)
683 695
684 } // namespace settings 696 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698