Skip to content

Commit

Permalink
Files.app: Add private API to check if PiexLoader is enabled or not.
Browse files Browse the repository at this point in the history
PiexLoader is enabled only for official build.

BUG=396702
TEST=None
R=isherman@chromium.org

Review URL: https://codereview.chromium.org/1026733003

Cr-Commit-Position: refs/heads/master@{#321933}
  • Loading branch information
hirono-chromium authored and Commit bot committed Mar 24, 2015
1 parent cbee853 commit a54475b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,15 @@ void FileManagerPrivateGetMimeTypeFunction::OnGetMimeType(
SendResponse(true);
}

ExtensionFunction::ResponseAction
FileManagerPrivateIsPiexLoaderEnabledFunction::Run() {
#if defined(OFFICIAL_BUILD)
return RespondNow(OneArgument(
new base::FundamentalValue(true)));
#else
return RespondNow(OneArgument(
new base::FundamentalValue(false)));
#endif
}

} // namespace extensions
15 changes: 15 additions & 0 deletions chrome/browser/chromeos/extensions/file_manager/private_api_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@ class FileManagerPrivateGetMimeTypeFunction
void OnGetMimeType(const std::string& mimeType);
};

// Implements the chrome.fileManagerPrivate.isPiexLoaderEnabled method.
class FileManagerPrivateIsPiexLoaderEnabledFunction
: public UIThreadExtensionFunction {
public:
FileManagerPrivateIsPiexLoaderEnabledFunction() {}
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.isPiexLoaderEnabled",
FILEMANAGERPRIVATE_ISPIEXLOADERENABLED)
protected:
~FileManagerPrivateIsPiexLoaderEnabledFunction() override {}

private:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateIsPiexLoaderEnabledFunction);
};

} // namespace extensions

#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
3 changes: 3 additions & 0 deletions chrome/common/extensions/api/file_manager_private.idl
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,9 @@ interface Functions {
DOMString key,
DOMString value,
SimpleCallback callback);

// Returns if Piex loader is enabled.
static void isPiexLoaderEnabled(BooleanCallback callback);
};

interface Events {
Expand Down
1 change: 1 addition & 0 deletions extensions/browser/extension_function_histogram_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ enum HistogramValue {
FILEMANAGERPRIVATE_ENABLEEXTERNALFILESCHEME,
DEVELOPERPRIVATE_UPDATEEXTENSIONCONFIGURATION,
DEVELOPERPRIVATE_DELETEEXTENSIONERRORS,
FILEMANAGERPRIVATE_ISPIEXLOADERENABLED,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms.xml.
ENUM_BOUNDARY
Expand Down
6 changes: 6 additions & 0 deletions third_party/closure_compiler/externs/file_manager_private.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ chrome.fileManagerPrivate.isUMAEnabled = function(callback) {};
*/
chrome.fileManagerPrivate.setEntryTag = function(entryURL, visibility, key, value, callback) {};

/**
* Gets a flag indicating whether PiexLoader is enabled.
* @param {function(boolean)} callback
*/
chrome.fileManagerPrivate.isPiexLoaderEnabled = function(callback) {};

/** @type {!ChromeEvent} */
chrome.fileManagerPrivate.onMountCompleted;

Expand Down
1 change: 1 addition & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49317,6 +49317,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="980" label="FILEMANAGERPRIVATE_ENABLEEXTERNALFILESCHEME"/>
<int value="981" label="DEVELOPERPRIVATE_UPDATEEXTENSIONCONFIGURATION"/>
<int value="982" label="DEVELOPERPRIVATE_DELETEEXTENSIONERRORS"/>
<int value="983" label="FILEMANAGERPRIVATE_ISPIEXLOADERENABLED"/>
</enum>

<enum name="ExtensionInstallCause" type="int">
Expand Down

0 comments on commit a54475b

Please sign in to comment.