Commit 81c8f0a8 authored by dvh@chromium.org's avatar dvh@chromium.org

Show modal dialog to tell users that the profile is managed when it's the case.

Apps Developer Tools will close when the user close the dialog.

Here's a screenshot of the dialog.
http://i.imgur.com/aO03CqB.png

BUG=267679

Review URL: https://chromiumcodereview.appspot.com/23460005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220484 0039d316-1c4b-4281-b951-d872f2087c98
parent 1a2969c3
...@@ -4530,6 +4530,15 @@ Make sure you do not expose any sensitive information. ...@@ -4530,6 +4530,15 @@ Make sure you do not expose any sensitive information.
<message name="IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_EXTENSION" desc="Text of the message of the apps/extension delete confirmation dialog in case the user is deleting an extension."> <message name="IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_EXTENSION" desc="Text of the message of the apps/extension delete confirmation dialog in case the user is deleting an extension.">
Do you really want to delete this extension? Do you really want to delete this extension?
</message> </message>
<message name="IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_CLOSE_BUTTON" desc="Title of the button to close the dialog for managed profile.">
Close
</message>
<message name="IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_TITLE" desc="Title of the dialog for managed profile.">
This user is supervised.
</message>
<message name="IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_DESCRIPTION" desc="Content of the dialog for managed profile. It's informing a supervised user that extensions cannot be changed.">
Applications and extensions cannot be modified by supervised users. Apps Developer Tools will be closed.
</message>
<message name="IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY" desc="Text on next line after IDS_EXTENSIONS_NONE_INSTALLED that suggests the user look in the gallery for extensions to install."> <message name="IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY" desc="Text on next line after IDS_EXTENSIONS_NONE_INSTALLED that suggests the user look in the gallery for extensions to install.">
Want to <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>browse the gallery<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph> instead? Want to <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>browse the gallery<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph> instead?
</message> </message>
...@@ -4659,7 +4668,7 @@ Make sure you do not expose any sensitive information. ...@@ -4659,7 +4668,7 @@ Make sure you do not expose any sensitive information.
(This extension is managed and cannot be removed or disabled.) (This extension is managed and cannot be removed or disabled.)
</message> </message>
<message name="IDS_EXTENSIONS_LOCKED_MANAGED_USER" desc="The error message (either shown in the extensions UI or logged) informing a supervised user that extensions cannot be changed."> <message name="IDS_EXTENSIONS_LOCKED_MANAGED_USER" desc="The error message (either shown in the extensions UI or logged) informing a supervised user that extensions cannot be changed.">
Extensions cannot be modified by supervised users. Applications and extensions cannot be modified by supervised users.
</message> </message>
<message name="IDS_EXTENSIONS_USE_APPS_DEV_TOOLS" desc="The message in the banner to invite people to use Apps Developer Tools."> <message name="IDS_EXTENSIONS_USE_APPS_DEV_TOOLS" desc="The message in the banner to invite people to use Apps Developer Tools.">
The new Apps Developer Tools makes it easier than ever to manage and debug your apps and extensions. It's now available in the Chrome App Launcher. The new Apps Developer Tools makes it easier than ever to manage and debug your apps and extensions. It's now available in the Chrome App Launcher.
......
...@@ -1248,12 +1248,29 @@ bool DeveloperPrivateGetStringsFunction::RunImpl() { ...@@ -1248,12 +1248,29 @@ bool DeveloperPrivateGetStringsFunction::RunImpl() {
SET_STRING("deleteConfirmationMessageExtension", SET_STRING("deleteConfirmationMessageExtension",
IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_EXTENSION); IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_EXTENSION);
// Dialog when profile is managed.
SET_STRING("managedProfileDialogCloseButton",
IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_CLOSE_BUTTON);
SET_STRING("managedProfileDialogTitle",
IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_TITLE);
SET_STRING("managedProfileDialogDescription",
IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_DESCRIPTION);
#undef SET_STRING #undef SET_STRING
return true; return true;
} }
DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {}
bool DeveloperPrivateIsProfileManagedFunction::RunImpl() {
SetResult(new base::FundamentalValue(profile_->IsManaged()));
return true;
}
DeveloperPrivateIsProfileManagedFunction::
~DeveloperPrivateIsProfileManagedFunction() {
}
} // namespace api } // namespace api
} // namespace extensions } // namespace extensions
...@@ -349,6 +349,18 @@ class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction { ...@@ -349,6 +349,18 @@ class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE; virtual bool RunImpl() OVERRIDE;
}; };
class DeveloperPrivateIsProfileManagedFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.isProfileManaged",
DEVELOPERPRIVATE_ISPROFILEMANAGED);
protected:
virtual ~DeveloperPrivateIsProfileManagedFunction();
// ExtensionFunction
virtual bool RunImpl() OVERRIDE;
};
class DeveloperPrivateExportSyncfsFolderToLocalfsFunction class DeveloperPrivateExportSyncfsFolderToLocalfsFunction
: public AsyncExtensionFunction { : public AsyncExtensionFunction {
public: public:
......
...@@ -617,6 +617,7 @@ enum HistogramValue { ...@@ -617,6 +617,7 @@ enum HistogramValue {
SYNCFILESYSTEM_GETSERVICESTATUS, SYNCFILESYSTEM_GETSERVICESTATUS,
ECHOPRIVATE_SETOFFERINFO, ECHOPRIVATE_SETOFFERINFO,
ECHOPRIVATE_GETOFFERINFO, ECHOPRIVATE_GETOFFERINFO,
DEVELOPERPRIVATE_ISPROFILEMANAGED,
ENUM_BOUNDARY // Last entry: Add new entries above. ENUM_BOUNDARY // Last entry: Add new entries above.
}; };
......
...@@ -96,6 +96,23 @@ cr.define('apps_dev_tool', function() { ...@@ -96,6 +96,23 @@ cr.define('apps_dev_tool', function() {
chrome.developerPrivate.getStrings(function(strings) { chrome.developerPrivate.getStrings(function(strings) {
loadTimeData.data = strings; loadTimeData.data = strings;
i18nTemplate.process(document, loadTimeData); i18nTemplate.process(document, loadTimeData);
// Check managed profiles.
chrome.developerPrivate.isProfileManaged(function(isManaged) {
if (!isManaged)
return;
alertOverlay.setValues(
loadTimeData.getString('managedProfileDialogTitle'),
loadTimeData.getString('managedProfileDialogDescription'),
loadTimeData.getString('managedProfileDialogCloseButton'),
null,
function() {
AppsDevTool.showOverlay(null);
window.close();
},
null);
AppsDevTool.showOverlay($('alertOverlay'));
});
}); });
}; };
......
...@@ -204,6 +204,9 @@ namespace developerPrivate { ...@@ -204,6 +204,9 @@ namespace developerPrivate {
// strings as a dictionary mapping from string identifier to the // strings as a dictionary mapping from string identifier to the
// translated string to use in the apps_debugger app UI. // translated string to use in the apps_debugger app UI.
static void getStrings(GetStringsCallback callback); static void getStrings(GetStringsCallback callback);
// Returns true if the profile is managed.
static void isProfileManaged(BooleanCallback callback);
}; };
interface Events { interface Events {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment